PHPackages                             in2code/alternative - 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. in2code/alternative

ActiveTypo3-cms-extension[Image &amp; Media](/categories/media)

in2code/alternative
===================

Automatically set alternative texts for images

4.1.0(4mo ago)61.2k↑71.4%1[1 issues](https://github.com/in2code-de/alternative/issues)[3 PRs](https://github.com/in2code-de/alternative/pulls)GPL-2.0-or-laterPHPPHP &gt;=8.2.0

Since Dec 3Pushed 4mo agoCompare

[ Source](https://github.com/in2code-de/alternative)[ Packagist](https://packagist.org/packages/in2code/alternative)[ Docs](https://www.in2code.de)[ GitHub Sponsors](https://github.com/orgs/in2code-de/sponsoring)[ Fund](https://www.in2code.de/supportopensource)[ RSS](/packages/in2code-alternative/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (20)Versions (10)Used By (0)

Alternative - AI generated metatags for images in TYPO3 with Google Gemini
==========================================================================

[](#alternative---ai-generated-metatags-for-images-in-typo3-with-google-gemini)

Introduction
------------

[](#introduction)

This TYPO3 extension allows setting alternative texts, title labels and a description for images in a filestorage. This can be done via file list backend module or via command on the CLI.

Example metadata labels from AI: [![documentation_example1.png](Documentation/Images/documentation_example1.png)](Documentation/Images/documentation_example1.png)

Example backend integration: [![documentation_example2.png](Documentation/Images/documentation_example2.png)](Documentation/Images/documentation_example2.png)

Example CLI command: [![documentation_example3.png](Documentation/Images/documentation_example3.png)](Documentation/Images/documentation_example3.png)

Google Gemini API
-----------------

[](#google-gemini-api)

- To use the extension, you need a **Google Gemini API** key. You can register for one at .
- Alternatively, you can implement your own LLM provider (see [Custom LLM Integration](#custom-llm-integration-like-chatgpt-claude-mistral-etc) below).

Installation
------------

[](#installation)

```
composer req in2code/alternative

```

After that, you have to set some initial configuration in Extension Manager configuration:

TitleDefault valueDescriptionsetAlternative1Toggle function: Set a value for alternative textsetTitle1Toggle function: Set a value for image titlesetDescription1Toggle function: Set a value for a descriptionshowButtonInFileList1Show or hide button in backend module file listapiKey-Google Gemini API key. You can let this value empty and simply use ENV\_VAR "GOOGLE\_API\_KEY" instead if you want to use CI pipelines for this settinglimitToLanguages-If set, limit to this language identifiers only. Use a commaseparated list of numbersmaxLengthTitle50Maximum number of characters for the title fieldmaxLengthAlternative125Maximum number of characters for the alternative text fieldmaxLengthDescription255Maximum number of characters for the description fieldpromptPrefixFile-Path to a text file with custom prompt prefix (e.g. `EXT:extension/Resources/Private/prompt.txt` or `fileadmin/promptprefix.txt` or `/var/www/prompt.txt`)Note: It's recommended to use ENV vars for in2code/alternative instead of saving the API-Key in Extension Manager configuration

```
GOOGLE_API_KEY=your_api_key_from_google

```

CLI commands
------------

[](#cli-commands)

```
# Set metadata for all image files in storage 1
./vendor/bin/typo3 alternative:set "1:/"

# Set metadata for all image files in a subfolder in storage 1 (maybe "fileadmin/in2code/folder/")
./vendor/bin/typo3 alternative:set "1:/in2code/folder/"

# Enforce to set metadata for all image files (even if there are already some metadata) in storage 1
./vendor/bin/typo3 alternative:set "1:/" 1

# Continue on errors (log and skip failed images instead of aborting)
./vendor/bin/typo3 alternative:set "1:/" 0 1

# Enforce and continue on errors
./vendor/bin/typo3 alternative:set "1:/" 1 1

```

Custom LLM Integration (like ChatGPT, Claude, Mistral, etc.)
------------------------------------------------------------

[](#custom-llm-integration-like-chatgpt-claude-mistral-etc)

Alternative uses a factory pattern to allow custom LLM providers. By default, it uses Google Gemini, but you can easily integrate other AI services (OpenAI, Claude, local models, etc.).

### Implementing a Custom LLM Repository

[](#implementing-a-custom-llm-repository)

1. Create a custom repository class implementing `RepositoryInterface` - see example for OpenAI ChatGPT:

```
