Class ImageComponent

ImageComponent

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

MethodReturn typeBrief description
setAltText(altText)ImageComponentSets the alternative text of the image.
setBorderStyle(borderStyle)ImageComponentSets the border style applied to the image.
setCropStyle(imageCropStyle)ImageComponentSets the crop style for the image.
setImageUrl(url)ImageComponentSets the URL of the image.

Detailed documentation

setAltText(altText)

Sets the alternative text of the image.

Parameters

NameTypeDescription
altTextStringThe alt_text to set for the image.

Return

ImageComponent — This object, for chaining.


setBorderStyle(borderStyle)

Sets the border style applied to the image.

Parameters

NameTypeDescription
borderStyleBorderStyleThe BorderStyle object to apply.

Return

ImageComponent — This object, for chaining.


setCropStyle(imageCropStyle)

Sets the crop style for the image.

Parameters

NameTypeDescription
imageCropStyleImageCropStyleThe ImageCropStyle object to apply.

Return

ImageComponent — This object, for chaining.


setImageUrl(url)

Sets the URL of the image.

Parameters

NameTypeDescription
urlStringThe URL.

Return

ImageComponent — This object, for chaining.