PHPackages                             in2code/imager - 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/imager

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

in2code/imager
==============

Adding images from Gemini with Nano Banana

2.0.1(5mo ago)31921[1 issues](https://github.com/in2code-de/imager/issues)GPL-2.0-or-laterPHPPHP &gt;=8.2.0

Since Nov 27Pushed 5mo agoCompare

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

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

Imager - AI generated images in TYPO3 with Google Gemini (Nano Banana)
======================================================================

[](#imager---ai-generated-images-in-typo3-with-google-gemini-nano-banana)

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Google Gemini with Nano Banana](#google-gemini-with-nano-banana)
- [Installation](#installation)
- [Extendability](#extendability)
- [Custom LLM Integration](#custom-llm-integration-like-dall-e-stable-diffusion-midjourney-etc)
- [Changelog and breaking changes](#changelog-and-breaking-changes)
- [Contribution with ddev](#contribution-with-ddev)

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

[](#introduction)

This allows editors to generate AI-generated images directly in the TYPO3 backend. This works using Google Gemini (with Nano Banana).

Example photo from Gemini: [![documentation_exampleimage1.png](Documentation/Images/documentation_exampleimage1.png)](Documentation/Images/documentation_exampleimage1.png)

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

Example graphic in frontend: [![documentation_frontend.png](Documentation/Images/documentation_frontend.png)](Documentation/Images/documentation_frontend.png)

Google Gemini with Nano Banana
------------------------------

[](#google-gemini-with-nano-banana)

- To use the extension, you need a **Google Gemini API** key. You can register for one at .
- Look at [https://ai.google.dev/gemini-api/docs/image-generation?hl=de#rest\_22](https://ai.google.dev/gemini-api/docs/image-generation?hl=de#rest_22) for example prompts and to learn more about the power of Gemini image creation
- Alternatively, you can implement your own LLM provider (see [Custom LLM Integration](#custom-llm-integration-like-dall-e-stable-diffusion-midjourney-etc) below).

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

[](#installation)

```
composer req in2code/imager

```

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

TitleDefault valueDescriptionpromptPlaceholderLLL:EXT:imager/Resources/Private/Language/Backend/locallang.xlf:prompt.placeholderLLL path to a label for placeholder for prompt field in backendpromptValueLLL:EXT:imager/Resources/Private/Language/Backend/locallang.xlf:prompt.valueLLL path for a default value for prompt field in backendpromptPrefix-Prefix text that should be always added to the prompt at the beginningcombinedIdentifier1:/\_imager/Define where to store new ai generated imagesaspectRatio16:9Default ratio for new ai images. Must be one of this values: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9model3\_pro\_image\_previewSelect a Gemini model (prices in Gemini may differ on different models)apiKey-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 settingNote: It's recommended to use ENV vars for in2code/imager instead of saving the API-Key in Extension Manager configuration

```
GOOGLE_API_KEY=your_api_key_from_google

```

Extendability
-------------

[](#extendability)

There are some events in EXT:imager that can be used to

- Decide to hide the button in backend (\\In2code\\Imager\\Events\\ButtonAllowedEvent::class)
- Manipulate or overrule the template of the rendered button in backend (\\In2code\\Imager\\Events\\TemplateButtonEvent::class)
- Manipulte the URL and request values before sending to Gemini (\\In2code\\Imager\\Events\\BeforeRequestEvent::class)

Custom LLM Integration (like DALL-E, Stable Diffusion, Midjourney, etc.)
------------------------------------------------------------------------

[](#custom-llm-integration-like-dall-e-stable-diffusion-midjourney-etc)

Imager uses a factory pattern to allow custom LLM providers. By default, it uses Google Gemini, but you can easily integrate other AI services (OpenAI DALL-E, Stable Diffusion, Midjourney, etc.).

### Implementing a Custom LLM Repository

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

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

```
