> ## Documentation Index
> Fetch the complete documentation index at: https://docs.instructorphp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Image data

## Overview

`Image` class in Instructor PHP provides an easy way to include images in your prompts.
It supports loading images from files, URLs, or base64 encoded strings. The image can
be sent as part of the message content to the LLM.

## Example

```php theme={null}
<?php
require 'examples/boot.php';

use Cognesy\Messages\Content;
use Cognesy\Messages\ContentPart;
use Cognesy\Messages\Messages;
use Cognesy\Messages\Utils\Image;
use Cognesy\Polyglot\Inference\Inference;

$messages = Messages::empty()
    ->asSystem('You are an expert in car damage assessment.')
    ->asUser(Content::empty()
        ->addContentPart(ContentPart::text('Describe the car damage in the image.'))
        ->addContentPart(Image::fromFile(__DIR__ . '/car-damage.jpg')->toContentPart())
    );

$response = Inference::using('openai')
    ->withModel('gpt-4o-mini')
    ->withMessages($messages)
    ->get();

echo "Response: " . $response . "\n";

assert(!empty($response), 'Expected non-empty response from image inference');
?>
```
