Drupal is a registered trademark of Dries Buytaert

media_image_metadata

70 sites Security covered
View on drupal.org

This module extracts metadata from image files and maps them to media fields.

Any metadata embedded in images according to the standards:

can be retrieved by this module.

A mapping is provided to make it easier to access the most commonly-used attributes without having to know exactly the code/address of the data in the different standards.

Metadata Attributes Provided

The above table shows the prioritization order for each metadata attribute. For example, when looking for the caption metadata attribute, the module will first look at the 2#120 value (in IPTC data), and if this is empty, it will fall back to dc:description (in XMP data), and finally to ImageDescription (in EXIF data).


Note:

The title attribute will fall back to the filename, if none of the above sources returned a non-empty value.

Retrieving unmapped metadata from images

If your images have metadata embedded in different locations, you can easily alter the above mapping by implementing the hook_media_image_metadata_alter() hook in a custom module, like so:

function foo_media_image_metadata_alter(array &$normalized_metadata, array $raw_metadata) {
  // Use IPTC "Special Instruction" as caption.
  if (!empty($raw_metadata['iptc']['2#40'])) {
    $normalized_metadata['caption'] = $raw_metadata['iptc']['2#40'];
  }
}

Requirements

  • Media module (from core)
  • (Optional) PHP 8.2+ with EXIF extension (only if you need EXIF metadata)

Activity

Total releases
7
First release
Sep 2025
Latest release
3 months ago
Release cadence
11 days
Stability
86% stable

Release Timeline

Releases

Version Type Release date
1.0.6 Stable Nov 27, 2025
1.0.5 Stable Oct 20, 2025
1.0.4 Stable Oct 1, 2025
1.0.3 Stable Sep 26, 2025
1.0.2 Stable Sep 26, 2025
1.0.1 Stable Sep 24, 2025
1.0.x-dev Dev Sep 20, 2025