Download the PHP package tfd/statamic-aida without Composer
On this page you can find all versions of the php package tfd/statamic-aida. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tfd/statamic-aida
More information about tfd/statamic-aida
Files in tfd/statamic-aida
Package statamic-aida
Short Description A Statamic addon that automates the generation of image alt texts using AI, enhancing web accessibility and SEO with minimal effort.
License MIT
Homepage https://github.com/21stdigital/statamic-aida
Informations about the package statamic-aida
A.I.D.A - AI-Driven Alt-text Assistant
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
- 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
Installation
- Install the addon using Composer:
Configuration
To set up and customize the A.I.D.A addon, follow these steps:
-
Publish Configuration File: Start by publishing the addon's configuration file to make it editable. Run the following command in your terminal:
This will copy the default configuration file to your application's
config
directory, allowing you to customize the addon settings. -
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 theaida.php
configuration file:Add the following line to your
.env
file:This ensures your API key remains secure and not hard-coded in your version-controlled files.
-
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. Then, specify your queue connection for A.I.D.A by adding the following line to your
.env
file:This tells A.I.D.A to use the
redis
queue connection for processing alt text generation jobs. -
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:For additional information please have a look at the
config/aida.php
file. -
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:With this setting enabled, every new image uploaded will automatically have an alt text generated, enhancing accessibility and SEO with minimal effort.
Example Configurations
Single Site with no custom alt field
- single site with handle
en
- asset alt field has default handle
alt
Single Site with custom alt field
- single site with handle
en
- asset alt field has a custom handle
my_custom_alt
Multi Site (1)
- multiple sites with handles
en
,fr
,de
- assets have a custom alt field for every language
alt_en
alt_fr
alt_de
Multi Site (2)
- multiple sites with handles
en
,fr
,de
- assets have a custom alt field for every language
alt_english
alt_french
alt_german
Multi Site (3)
- multiple sites with handles
en
,fr
,de
- assets only have alt fields for a subset of languages:
alt_en
alt_de
Updates
After updating the addon, make sure to inspect the config/aida.php
file to learn about new configuration values. You might want to add them to the published config file of your application.
Usage
Manual Generation: Use the Generate Alt Text action in the Asset Browser to generate alt texts for selected images. This option allows you to decide whether to override existing alt texts.
Customization
Custom Generator: You can replace the default OpenAI-based generator with your own by implementing the TFD\AIDA\Generator\Generator
interface.
-
Create a custom generator class e.g.
/app/Generator/MyAltTextGenerator.php
. - Implement the
generate
method to utilize your preferred service for generating alt texts. - Update the
aida.php
configuration file to use your custom generator class.
Credits
This project is maintained by 21st digital. We appreciate the contributions from the community that help make this project better.