# auto-alt-text/2.7.0/src/App/Domain/Exceptions/InvalidImageException.php

Auto Alt Text, version 2.7.0. 38 lines.

- Page: https://pluginprobe.com/plugins/auto-alt-text/2.7.0/code/src/App/Domain/Exceptions/InvalidImageException.php
- Raw: https://pluginprobe.com/plugins/auto-alt-text/2.7.0/raw/src/App/Domain/Exceptions/InvalidImageException.php
- Modified: 2026-01-14T13:38:28+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/auto-alt-text/2.7.0/code/src/App/Domain/Exceptions/InvalidImageException.php#L10-L20`.

```php
<?php

namespace AATXT\App\Domain\Exceptions;

use Exception;

/**
 * Exception thrown when an image is invalid or has unsupported MIME type.
 *
 * This exception is thrown when attempting to generate alt text for an image
 * that doesn't meet the provider's requirements (e.g., unsupported format).
 */
class InvalidImageException extends Exception
{
    /**
     * Constructor
     *
     * @param int $imageId The WordPress attachment ID
     * @param string $mimeType The MIME type of the image
     * @param array $supportedTypes List of supported MIME types
     */
    public function __construct(int $imageId, string $mimeType, array $supportedTypes = [])
    {
        $supportedList = !empty($supportedTypes)
            ? implode(', ', $supportedTypes)
            : 'none specified';

        parent::__construct(
            sprintf(
                'Image ID %d has unsupported MIME type "%s". Supported types: %s',
                $imageId,
                $mimeType,
                $supportedList
            )
        );
    }
}

```
