An image component that can be added to grid items.
Available for Google Workspace Add-ons and Google Chat apps.
var ImageComponent = CardService.newImageComponent() .setImageUrl("http://imageurl.ca") .setAltText(altText) .setCropStyle(CARD_SERVICE.newImageCropStyle()) .setBorderStyle(CARD_SERVICE.newBorderStyle());
Methods
Method | Return type | Brief description |
---|---|---|
setAltText(altText) | ImageComponent | Sets the alternative text of the image. |
setBorderStyle(borderStyle) | ImageComponent | Sets the border style applied to the image. |
setCropStyle(imageCropStyle) | ImageComponent | Sets the crop style for the image. |
setImageUrl(url) | ImageComponent | Sets the URL of the image. |
Detailed documentation
setAltText(altText)
Sets the alternative text of the image.
Parameters
Name | Type | Description |
---|---|---|
altText | String | The alt_text to set for the image. |
Return
ImageComponent
— This object, for chaining.
setBorderStyle(borderStyle)
Sets the border style applied to the image.
Parameters
Name | Type | Description |
---|---|---|
borderStyle | BorderStyle | The BorderStyle object to apply. |
Return
ImageComponent
— This object, for chaining.
setCropStyle(imageCropStyle)
Sets the crop style for the image.
Parameters
Name | Type | Description |
---|---|---|
imageCropStyle | ImageCropStyle | The ImageCropStyle object to apply. |
Return
ImageComponent
— This object, for chaining.
setImageUrl(url)
Sets the URL of the image.
Parameters
Name | Type | Description |
---|---|---|
url | String | The URL. |
Return
ImageComponent
— This object, for chaining.