Image content block for messages.
Represents an image attachment in a message. Supports both URL-based and base64-encoded images.
Fields
url- URL to the image (optional if data is provided)data- Base64-encoded image data (optional if url is provided)media_type- MIME type (e.g., "image/png", "image/jpeg")alt_text- Alternative text descriptionwidth- Image width in pixels (optional)height- Image height in pixels (optional)
Examples
Image.new("https://example.com/photo.jpg")
Image.new("https://example.com/photo.jpg", media_type: "image/jpeg", alt_text: "A photo")
Image.from_base64(base64_data, "image/png")
Summary
Functions
Creates a new image content block from base64-encoded data.
Creates a new image content block from a URL.
Returns the Zoi schema for Image content
Types
Functions
Creates a new image content block from base64-encoded data.
Parameters
data- Base64-encoded image datamedia_type- MIME type (required for base64 images)opts- Additional options (alt_text, width, height)
Creates a new image content block from a URL.
Options
:media_type- MIME type of the image:alt_text- Alternative text description:width- Image width in pixels:height- Image height in pixels
Returns the Zoi schema for Image content