AI Media documentation¶
AI Media lets editors generate media with AI right where they already pick media: the Media Library. Describe what you need, review what the AI makes, then save it to the library and select it, like any upload.
It generates images, SVGs and, experimental, videos, each a plugin:
| Generator | Saves into (default) | AI operations | Files |
|---|---|---|---|
| Image | Image (core Image source) | text_to_image |
png, jpg, webp |
| SVG, static or animated | SVG Image (core Image source, svg) | chat, then sanitized |
svg |
| Video (experimental, off by default) | Video (core Video file source) | text_to_image, then image_to_video |
mp4 |
The Video generator is experimental and off by default: turn it on with Enabled in the generators table of the settings. The AI module's image-to-video operation takes no motion description yet (#3586540), and no provider in the AI module family offers image to video today. It makes a first frame from the description, then hands it to an image-to-video provider within one request; its tab says "Video generation is slow and usually costs much more than an image."
Each generator saves into one of the site's own media types, so generated media are ordinary Image, SVG Image or Video media: image styles, view modes, formatters and Insert Media in CKEditor 5 keep working.
Pages¶
| Page | For | What it covers |
|---|---|---|
| Generating media in the Media Library | Editors | The AI tabs, describing, options, Generate again, review and save |
| Media types and generators | Site administrators | Choosing the media type each generator saves into, the AI tabs, Add media, upgrading from alpha1 |
| Settings | Site administrators | Every setting on the AI Media settings page and where it takes effect |
| Providers | Site administrators | The AI module defaults each AI call uses |
| SVG and animated SVG | Site administrators, site builders | Static and animated SVG, the Animated SVG component and display, sanitizing, the example recipe |
| How AI Media works with the AI module | Site administrators, developers | Tags, guardrails and the Safety tab, moderation, AI Prompts, AI Context, logging |
| Permissions | Site administrators | Who can generate, who can change the settings |
| Writing a generator plugin | Developers | Adding a new kind of generated media |
| Troubleshooting | Everyone | The traps that look like bugs and are not |
Requirements¶
- Drupal 11.3 or later (core HTMX) and PHP 8.4.
- Core Media Library and Image.
- The AI module 1.4 or later, with a provider for each operation your generators call.
Getting started¶
- Install the module:
composer require drupal/ai_media, thendrush en ai_media. - Check the media type each generator saves into: Image and SVG Image by default (Media types and generators).
- Give the editors' role Generate media with AI and create access for those media types.
- Check Configuration > AI > AI Media
(
/admin/config/ai/ai-media).
About this documentation¶
Written for the 1.0.x branch.