Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Media Alt Caption

No security coverage Maintenance fixes only 4 sites

This module automatically sets the caption field for media items with the value from their alt text.

Media Alt Caption fills the caption of image media with the image's alt text. Editors describe an image once and get both an accessible alt text for screen readers and a visible caption for everyone.

Captions written by editors are never overwritten. The module only fills captions that are empty, and can optionally keep a caption in step with the alt text until someone edits it.

Features

  • Automatic captions: when an image media item is saved with an empty caption, the caption gets the image's alt text, or its title when there is no alt text.
  • Works with any image media type: every media type whose source is an image is detected automatically, whatever its fields are called.
  • Per media type settings: choose which text field holds the caption, and the behavior:
    • Fill empty captions: only empty captions are filled.
    • Also follow alt text changes: the caption is updated when the alt text changes, as long as nobody has edited the caption by hand.
  • Fill existing media in one go: from the settings page, which shows how many media items have no caption yet, or with Drush. A dry-run option counts them first. The media items' "changed" date is not modified.
  • Ready to use: installing the module adds a Caption field to your image media types, on both the media form and the display below the image.
  • Safe:
    • alt text is stored as plain text, so it is never interpreted as HTML;
    • other media types, such as documents and videos, are left alone;
    • uninstalling the module keeps the Caption fields and every caption in them.

Requirements

  • Drupal 10.3 or later, or Drupal 11.
  • The core Media module, and at least one media type with an image source, such as the standard Image type.

Installation

Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.

composer require drupal/media_alt_caption
drush pm:enable media_alt_caption

Configuration

  1. Go to Configuration » Media » Media alt caption (/admin/config/media/media-alt-caption). This requires the Administer media permission.
  2. For each image media type, choose whether to fill captions, the caption field and the behavior.
  3. To give existing media a caption, click Save and fill existing captions, or use Drush:
    drush media-alt-caption:fill --dry-run   # count the media without a caption
    drush media-alt-caption:fill             # fill them

Support

Report bugs and request features in the issue queue.

Drupal 10–11

Ask your assistant about Media Alt Caption

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • field Drupal core
  • file Drupal core
  • image Drupal core
  • media Drupal core
  • text Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Nov 2024
Latest release
1 month ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core PHP Release date
1.0.1 Stable 10–11 Oct 15, 2026
1.0.0 Stable 10–11 Nov 17, 2024