ImageComponent

An image component that can be added to grid items.

Available for Google Workspace add-ons and Google Chat apps.

```javascript
const ImageComponent = CardService.newImageComponent()
                           .setImageUrl('http://imageurl.ca')
                           .setAltText('YOUR ALT TEXT')
                           .setCropStyle(CardService.newImageCropStyle())
                           .setBorderStyle(CardService.newBorderStyle());
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/card-service/image-component#setAltText(String)` | `https://developers.google.com/apps-script/reference/card-service/image-component#` | Sets the alternative text of the image. |
| `https://developers.google.com/apps-script/reference/card-service/image-component#setBorderStyle(BorderStyle)` | `https://developers.google.com/apps-script/reference/card-service/image-component#` | Sets the border style applied to the image. |
| `https://developers.google.com/apps-script/reference/card-service/image-component#setCropStyle(ImageCropStyle)` | `https://developers.google.com/apps-script/reference/card-service/image-component#` | Sets the crop style for the image. |
| `https://developers.google.com/apps-script/reference/card-service/image-component#setImageUrl(String)` | `https://developers.google.com/apps-script/reference/card-service/image-component#` | 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


`https://developers.google.com/apps-script/reference/card-service/image-component#` --- This object, for chaining.

*** ** * ** ***

### `setBorderStyle(borderStyle)`

Sets the border style applied to the image.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `borderStyle` | `https://developers.google.com/apps-script/reference/card-service/border-style` | The BorderStyle object to apply. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/image-component#` --- This object, for chaining.

*** ** * ** ***

### `setCropStyle(imageCropStyle)`

Sets the crop style for the image.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `imageCropStyle` | `https://developers.google.com/apps-script/reference/card-service/image-crop-style` | The ImageCropStyle object to apply. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/image-component#` --- This object, for chaining.

*** ** * ** ***

### `setImageUrl(url)`

Sets the URL of the image.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `url` | `String` | The URL. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/image-component#` --- This object, for chaining.