This project is not covered by Drupal’s security advisory policy.
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
- Go to Configuration » Media » Media alt caption (
/admin/config/media/media-alt-caption). This requires the Administer media permission. - For each image media type, choose whether to fill captions, the caption field and the behavior.
- 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.
Supporting organizations:
Module development
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.Maintenance fixes only
Considered feature-complete by its maintainers.- Project categories: Media
4 sites report using this module
- Created by chaitanyadessai on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.