# Image element

Displays an image as part of a larger block of content.

| | |
|---|---|
| **Type** | `image` |
| **Available in** | Messages, Modals, Home tab |
| **Works in blocks** | [Section block](https://workstation.repzo.com/docs/developers/block-kit/blocks/section-block), [Context block](https://workstation.repzo.com/docs/developers/block-kit/blocks/context-block), [Card block](https://workstation.repzo.com/docs/developers/block-kit/blocks/card-block) |

## Usage

Use the image element as a section block's `accessory`, among a context block's `elements`, or as a card block's `hero_image` or `icon`. Use the [image block](https://workstation.repzo.com/docs/developers/block-kit/blocks/image-block) if you want a block with _only_ an image in it.

## Fields

| Field | Type | Description | Required? |
|---|---|---|---|
| `type` | String | The type of element. In this case `type` is always `image`. | Required |
| `alt_text` | String | A plain-text summary of the image. This should not contain any markup. | Required |
| `image_url` | String | The URL for a publicly hosted image. Only `http` and `https` URLs are shown. Maximum length for this field is 3000 characters. | Required |

> **How Repzo Chat differs from Slack**
>
> - `slack_file` isn't supported: host the image and pass its `image_url`.

## Examples

### A section with an image

```json
{
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*Ergonomic Office Chair — Model E2*\nIn stock: 48 units · List price: *$329*\nBest seller this quarter in the Northwind account."
      },
      "accessory": {
        "type": "image",
        "image_url": "https://picsum.photos/id/1062/300/300",
        "alt_text": "Office chair product photo"
      }
    }
  ]
}
```

### Images in a context block

```json
{
  "blocks": [
    {
      "type": "context",
      "elements": [
        {
          "type": "image",
          "image_url": "https://picsum.photos/id/1005/64/64",
          "alt_text": "Account owner avatar"
        },
        {
          "type": "mrkdwn",
          "text": "Owned by the *Enterprise* team · Last activity 2 hours ago"
        }
      ]
    }
  ]
}
```

## Related

- [Block elements](https://workstation.repzo.com/docs/developers/block-kit/elements)
- [Block Kit overview](https://workstation.repzo.com/docs/developers/block-kit)
