public class AmpImage extends AmpComponent
Modifier and Type | Field and Description |
---|---|
protected int |
defaultHeight |
protected int |
defaultWidth |
Constructor and Description |
---|
AmpImage(int width,
int height)
Create instance of AmpImage.
|
Modifier and Type | Method and Description |
---|---|
String |
getAlt()
A string of alternate text, similar to the alt attribute on img.
|
String |
getRequiredScript()
Required script that muct be added to head section.
|
String |
getSrc()
Similar to the src attribute on the img tag.
|
boolean |
isValid()
Indicates whether this image is valid of AmpImage.
|
void |
setAlt(String value)
A string of alternate text, similar to the alt attribute on img.
|
void |
setSrc(String value)
Similar to the src attribute on the img tag.
|
String |
toAmpHtml()
Represents amp html version of component.
|
String |
toHtml()
Represents html version of component.
|
getAttributes, getFallback, getPlaceholder, setFallback, setPlaceholder
public AmpImage(int width, int height)
Create instance of AmpImage.
width
- width of AmpImageheight
- height of AmpImagepublic final String getSrc()
Similar to the src attribute on the img tag. The value must be a URL that points to a publicly-cacheable image file
public final void setSrc(String value)
Similar to the src attribute on the img tag. The value must be a URL that points to a publicly-cacheable image file
public final String getAlt()
A string of alternate text, similar to the alt attribute on img.
public final void setAlt(String value)
A string of alternate text, similar to the alt attribute on img.
public final boolean isValid()
Indicates whether this image is valid of AmpImage.
public String getRequiredScript()
Required script that muct be added to head section.
getRequiredScript
in class AmpComponent
public String toAmpHtml()
Represents amp html version of component.
toAmpHtml
in class AmpComponent
public String toHtml()
Represents html version of component.
toHtml
in class AmpComponent