PHPackages                             tfd/statamic-aida - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. tfd/statamic-aida

ActiveLibrary[Image &amp; Media](/categories/media)

tfd/statamic-aida
=================

A Statamic addon that automates the generation of image alt texts using AI, enhancing web accessibility and SEO with minimal effort.

2.2.0(8mo ago)53.3k↓39.6%3[11 issues](https://github.com/21stdigital/statamic-aida/issues)[4 PRs](https://github.com/21stdigital/statamic-aida/pulls)MITPHPCI passing

Since Mar 22Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/21stdigital/statamic-aida)[ Packagist](https://packagist.org/packages/tfd/statamic-aida)[ Docs](https://github.com/21stdigital/statamic-aida)[ RSS](/packages/tfd-statamic-aida/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (9)Versions (13)Used By (0)

 [![AIDA Logo](./docs/aida-logo-solo.svg)](./docs/aida-logo-solo.svg)
 A.I.D.A - AI-Driven Alt-text Assistant
===============================================================================================================

[](#------aida---ai-driven-alt-text-assistant)

 [ ![Statamic 5.0+](https://camo.githubusercontent.com/e5884c2cb5300b5dbff07bca9aa595c800b9696774768f3507886de418874214/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53746174616d69632d352e302532422d4646323639453f7374796c653d666c61742d737175617265) ](https://statamic.com) [ ![Latest Version](https://camo.githubusercontent.com/dfb15d271ef3a21daa16c6f12325c798694e19f1f4fd5c9fe93bd2669ca29098/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f323173746469676974616c2f73746174616d69632d616964613f6c6162656c3d52656c65617365267374796c653d666c61742d737175617265) ](https://github.com/21stdigital/statamic-aida/releases) [ ![](https://camo.githubusercontent.com/476a8c57514983206235459e932ac686b326e060b5c82a3c872df2eaeead70ed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f323173746469676974616c2f73746174616d69632d616964612f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d5465737473) ](https://github.com/21stdigital/statamic-aida/actions/workflows/tests.yml?query=branch%3Amain) [ ![](https://camo.githubusercontent.com/0ec9d3f117057aa791604a577a94d5f51d964a576e45bc390e1c009d38b25995/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7466642f73746174616d69632d616964613f7374796c653d666c61742d737175617265266c6162656c3d446f776e6c6f616473) ](https://packagist.org/packages/tfd/statamic-aida)

> Enhancing web accessibility and SEO through AI-generated alt texts for Statamic 5.

A.I.D.A is an addon for Statamic 5 that leverages AI to automatically generate descriptive alt texts for images. By simplifying this process, A.I.D.A aids in making web content more accessible to visually impaired users, enhances SEO, and supports content in multiple languages.

Features
--------

[](#features)

- **AI-Powered:** Utilizes AI to craft meaningful and contextually relevant alt texts.
- **Web Accessibility:** Improves accessibility for visually impaired users by providing descriptive image texts.
- **SEO Enhancement:** Boosts SEO by enabling search engines to better understand and index website images.
- **Multilingual Support:** Equally effective for both monolingual and multilingual websites.
- **Efficiency:** Saves time and resources by reducing manual effort required for writing alt texts.

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

1. Install the addon using Composer:

    ```
    composer require tfd/statamic-aida
    ```

### Configuration

[](#configuration)

To set up and customize the A.I.D.A addon, follow these steps:

1. **Publish Configuration File:** Start by publishing the addon's configuration file to make it editable. Run the following command in your terminal:

    ```
    php artisan vendor:publish --tag="aida-config"
    ```

    This will copy the default configuration file to your application's `config` directory, allowing you to customize the addon settings.
2. **Set OpenAI API Key:** A.I.D.A uses OpenAI to generate alt texts. You must provide your OpenAI API key for the service to function. It's recommended to set this key in your application's `.env` file for security reasons, rather than directly in the `aida.php` configuration file:

    Add the following line to your `.env` file:

    ```
    OPEN_AI_API_KEY=your_openai_api_key_here

    ```

    This ensures your API key remains secure and not hard-coded in your version-controlled files.
3. **Configure Queue:** To manage performance and efficiently handle multiple alt text generation requests, it's advisable to use a queue connection, such as Redis. Queues allow for asynchronous processing, improving the user experience and system performance.

    First, ensure you have your queue system set up according to the [Laravel documentation](https://laravel.com/docs/queues). Then, specify your queue connection for A.I.D.A by adding the following line to your `.env` file:

    ```
    GENERATE_ALT_TEXT_QUEUE=redis

    ```

    This tells A.I.D.A to use the `redis` queue connection for processing alt text generation jobs.
4. **Generator Configuration**: The default OpenAI Generator is configured with a sensible set of default values. You can adjust these values to better fit your needs.

    The following options are configurable via `.env` file:

    ```
    # Define the model that is used to process the images and generate alt texts. Only gtp-4 models are supported.
    OPEN_AI_MODEL=gpt-4o-mini

    # Limit the number of tokens that are used in the response.
    OPEN_AI_MAX_TOKENS=200

    # Adjust the value to balance image understanding quality with performance and cost.
    OPEN_AI_IMAGE_DETAIL=low

    ```

    For additional information please have a look at the `config/aida.php` file.
5. **Automatic Generation on Upload:** By default, the addon does not generate alt texts automatically upon image uploads to avoid unnecessary processing. However, you can enable this feature to have alt texts generated immediately as images are uploaded.

    To enable automatic alt text generation on upload, add the following line to your `.env` file:

    ```
    GENERATE_ALT_TEXT_ON_UPLOAD=true

    ```

    With this setting enabled, every new image uploaded will automatically have an alt text generated, enhancing accessibility and SEO with minimal effort.

### Example Configurations

[](#example-configurations)

#### Single Site with no custom alt field

[](#single-site-with-no-custom-alt-field)

- single site with handle `en`
- asset alt field has default handle `alt`

```
// config/statamic/aida.php
