---
title: "Image input"
description: "Send images to Workers AI vision models. Lists the attachment types that work."
---

> Documentation Index
> Fetch the complete documentation index at: https://laravel-cf-workersai-docs.mdick85.workers.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Image input

Attach images to a prompt. The package sends each image as an `image_url` content part. Choose a Workers AI model that accepts images.

```php
use Laravel\Ai\Files\Image;

$response = agent('Describe images.')->prompt(
    'What is in this picture?',
    attachments: [Image::fromPath(storage_path('app/photo.jpg'))],
    provider: 'workers-ai',
    model: '@cf/your/vision-model', // replace: see below
);
```

## Supported attachments

| Laravel AI class | Created with | Sent as |
| --- | --- | --- |
| `LocalImage` | `Image::fromPath()` | Base64 data URL |
| `StoredImage` | `Image::fromStorage()` | Base64 data URL |
| `Base64Image` | `Image::fromBase64()` | Base64 data URL |
| `RemoteImage` | `Image::fromUrl()` | The URL |
| Raw `UploadedFile` | Passed as is | Base64 data URL, MIME checked |
| Uploaded file | `Image::fromUpload()` | Base64 data URL (it becomes a `Base64Image`) |

The package checks the MIME type only when you pass a raw `Illuminate\Http\UploadedFile`, such as `$request->file('photo')`. It allows `image/jpeg`, `image/png`, `image/gif` and `image/webp`. For other types (SVG, AVIF, HEIC), it throws `InvalidArgumentException` with the message `Workers AI does not support document attachments. Only image attachments are supported.`

`Image::fromUpload()` returns a `Base64Image`, and the package does not check a `Base64Image`, `LocalImage`, `StoredImage` or `RemoteImage`. Cloudflare accepts or rejects those files. Send only the four types above.

## Not supported

- Documents. The package throws `InvalidArgumentException` with the same message. To use a document, extract its text and put the text in the prompt.
- Audio and video.
- Image generation.

> **Note**
>
> The package does not check that the model accepts images. Pick a vision model from the [Cloudflare model catalog](https://developers.cloudflare.com/workers-ai/models/) and copy its `@cf/...` name into `model:`.

## Images for Clef and Clairic

Clef and Clairic take images in a different request format. They accept up to 4 inline images, in JPEG, PNG or WebP. They reject remote URLs. See [Clef](/docs/system-one/clef/) and [Clairic](/docs/system-one/clairic/).

Source: https://laravel-cf-workersai-docs.mdick85.workers.dev/docs/guides/image-input/index.mdx
