The Media Library Image tab with the Upload | Generate with AI switch and its New badge
Generate with AI in the Image tab: an empty description field with Examples and an info button, and the Generate image button
The SVG Image tab with the same Upload | Generate with AI switch
The Video tab with the same Upload | Generate with AI switch
A generated image ready for review: name and alternative text written by AI from the image, the Focal Point crosshair in the centre, and the Generate with AI alt text button
The AI Media settings, Generators tab: offer the AI tabs, where they appear (inside the tab of their media type, or as tabs of their own) and the New badge

This project is not covered by Drupal’s security advisory policy.

Generate images and SVGs with AI right where editors already pick media: the Media Library. Each media type tab gets an Upload | ✦ Generate with AI switch. Describe what you need, review what the AI makes, with its name and alternative text already written, then save and select it like any upload.

AI Media 1.0.0-rc1 - CI AI Media documentation Join our Slack

AI Media documentation

Generating media, settings, SVG and animated SVG, providers, permissions, writing a generator and troubleshooting.


Generate with AI, right inside the Media Library

  • One tab per media type. Image, SVG Image and Video each start with an Upload | ✦ Generate with AI switch, with a New badge until it has been tried. Prefer separate tabs? One setting puts "Generate image with AI" right after Image, or after all the other tabs.
  • A tidy form. The description starts empty. Examples opens eight ready descriptions to start from, and an info button holds the AI disclosure: which provider makes it and what is sent.
  • Review before anything is saved. The name and the alternative text are written by AI from the generated image. The AI Image Alt Text button and Focal Point work on the result as on any upload. Generate again replaces it in place.
  • The same on the Add media page, and Content > Media has a Generate media with AI button.
  • Nothing reaches the library until you save. An unsaved result is a temporary file that cron removes.

What it can generate

  • Images (PNG, JPG, WebP) from a text-to-image model, saved as your Image media.
  • SVGs, static or animated (draw the strokes, CSS keyframes or SMIL), written by a chat model, sanitized and kept self-contained, saved as your SVG Image media.
  • Videos (MP4), experimental and off by default: a first frame from text to image, then an image-to-video provider.

Generated media are ordinary media of those types, so image styles, view modes, formatters and Insert Media in CKEditor 5 keep working.

Built on Drupal AI, not beside it

  • Providers come from the AI settings. AI Media uses the default provider and model the site sets for each operation, so switching to another provider, for example Gemini's image model, is one change in Drupal AI.
  • No AI rules of its own. Requests are tagged ai_media, so the site's guardrails, moderation, AI Prompts, AI Context, AI Logging and AI Observability all apply.

Animated SVG

The Animated SVG component, placeable in Canvas, and the Inline SVG (animated) display print an SVG inline and sanitized, start the motion when it scrolls into view, and show the finished drawing to people who prefer reduced motion. The included ai_media_svg_example recipe shows it right after install.

For developers

  • Each kind of media is an #[AiMediaGenerator] plugin: a new kind of generated media is a new plugin, not a fork.
  • Every setting can be applied from a recipe with config actions.

Requirements

Permissions and safety

  • Generating needs the Generate media with AI permission and create access for the media type, since every generation spends provider credit. Administer AI Media controls the settings.
  • SVGs keep only the svg element, are sanitized with remote references removed, and are refused unless they come out clean.
  • Editors get one plain sentence when generation fails; users with Administer AI also see the provider's message, with anything shaped like a key redacted.

Sponsored and developed by Vardot.Vardot

Supporting organizations: 
Initial building, ongoing maintenance and development

Project information

Releases