balt1794 / contao-alt-text-generator-ai
Write SEO-friendly alt text for the images in your Contao file manager with AI, in bulk, in 131 languages, with review before saving.
Package info
github.com/balt1794/contao-alt-text-generator-ai
Type:contao-bundle
pkg:composer/balt1794/contao-alt-text-generator-ai
Requires
- php: ^8.1
- contao/core-bundle: ^5.3 || ^6.0
- symfony/http-client: ^6.4 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^10.5 || ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Write SEO-friendly alt text for the images in your Contao file manager. Generate it for one image, for a selection, for every image that is missing it, or automatically when an image is uploaded. Review it, change anything you like, and save. 131 languages, with a German and an English back end.
What you get
- A bulk module. Alt Text Generator AI sits in the Content group of the back end menu, next to Files. It lists your images with a preview, shows the ones with no alt text, and writes it for all of them or only the ones you tick.
- Review before saving. Edit any text, then save everything at once. The text goes into the Alternate text field of the file's metadata, which Contao uses as the
altattribute of the image. - A button on every file. Open a file in the file manager and click Generate alt text beside its Alternate text, for each website language.
- Alt text on upload. Turn on Write alt text on upload and every new image gets its text as soon as it is uploaded.
- Your website languages. Choose the language of the text. It is saved for the website language that matches it, for example German text for a German root page, or for the language of your fallback root page when there is no match.
- 131 languages for the text, including English, German, French, Spanish, Italian, Dutch, Polish, Czech and Turkish.
- Credits shown in the module. One credit writes alt text for one image. New accounts get free credits.
- Your key stays on your server. The API key is only used by Contao's PHP code and never reaches the browser. The settings form never shows it again once it is saved.
Requirements
- Contao 5.3 LTS, 5.7 or 6.0
- PHP 8.1 or newer (PHP 8.3 for Contao 5.7, PHP 8.4 for Contao 6.0)
- An Alt Text Generator API key (get one free)
Install
With the Contao Manager, search for Alt Text Generator AI and install it.
With Composer:
composer require balt1794/contao-alt-text-generator-ai vendor/bin/contao-console contao:migrate
Then open System > Settings, find Alt Text Generator AI, paste your API key and save. You can also paste the key into the module the first time you open it. Only administrators can change the key.
Use it
- Open Alt Text Generator AI in the Content group. It lists your images and shows your credits. Click Scan images if you added files outside the file manager, for example over FTP.
- Missing shows the images with no alt text for the chosen website language. All shows everything.
- Tick the images you want, tick Select all to pick every image in the list, or leave them all unticked.
- Click Generate selected or Generate all missing. Each image uses 1 credit.
- Read the results, change anything you like, then click Save changes.
Generate all missing skips images that already have alt text. Tick an image to generate it anyway, or tick Overwrite images that already have alt text.
Alt text on upload
In System > Settings > Alt Text Generator AI, tick Write alt text on upload. New images get their alt text in the language you chose in the settings, saved for the matching website language. At most 10 images are described per upload request. If the key is missing or the credits are used up, the upload still works and the reason is written to the system log.
One image at a time
Open a file in the file manager. Beside Alternate text there is a Generate alt text button for each language in the metadata. The text appears in the field, and you save the file as usual.
Good to know
- Images are shrunk to 1024 px on the long side before they are sent. SVG files are not sent.
- The text is saved for a website language, which is the language of a root page. Contao shows the text on pages of that language. A text you type in a content element still wins over the file's metadata.
- Editors who are not administrators can generate and save for the files their file mounts allow, when their user group may edit the metadata of files.
- To point the extension at a different service URL, set the
ALT_TEXT_GENERATOR_AI_ENDPOINTenvironment variable.
Development
composer install vendor/bin/phpunit
Deutsch
Alt Text Generator AI erstellt mit KI barrierefreie und SEO-freundliche Alt-Texte für die Bilder in Ihrer Contao-Dateiverwaltung: für ein einzelnes Bild, für eine Auswahl, für alle Bilder ohne Alt-Text oder automatisch direkt beim Hochladen. Sie prüfen die Texte, ändern sie nach Wunsch und speichern sie. Sie landen im Feld Alternativer Text der Dateimetadaten, das Contao als alt-Attribut verwendet.
- Das Modul Alt Text Generator AI finden Sie in der Gruppe Inhalte neben der Dateiverwaltung.
- Den API-Schlüssel tragen Sie unter System > Einstellungen > Alt Text Generator AI ein. Einen kostenlosen Schlüssel erhalten Sie auf alttextgeneratorai.com.
- Der Schlüssel bleibt auf Ihrem Server und gelangt nie in den Browser.
- Die Oberfläche gibt es auf Deutsch und Englisch, die Alt-Texte in 131 Sprachen.
License
MIT
