Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Photo Metadata

Security covered Under active development 5 sites

This project extracts metadata from photos, such as GPS coordinates, dates, camera information, and captions, and saves it to media fields. It can also use AI to describe images and suggest keywords, and helps editors find nearby photos to use when editing content.

Photo Metadata reads the metadata stored inside photographs into media fields. It can also describe photographs with a vision model, and it can show editors the photographs taken near whatever they are editing. The project contains three modules, and each one works without the next.

Features

Photo Metadata

Reads each image file into media fields when the media item is first saved, and again whenever its file is replaced:

  • Coordinates: EXIF GPS, stored in a Geofield as signed decimal degrees.
  • Date taken: EXIF DateTimeOriginal, then DateTimeDigitized, then IFD0 DateTime.
  • Camera: EXIF Model.
  • Caption: IPTC caption, then EXIF ImageDescription.
  • Credit: IPTC by-line, then EXIF Artist.
  • Keywords: IPTC keywords, as taxonomy terms. An existing term is reused, whatever its case.
  • Focal point: copied from the Focal Point crop as x,y percentages, and updated whenever the crop changes.

Values are written only into empty fields, so an editor's corrections survive. An ordinary edit does not read the file again. That matters when files are in object storage, where each read is a download.

The module ships seven fields for the image media type. None of them is placed in a view display, so metadata never appears under a site's pictures unless the site adds it. Each role can point at a field the site already has instead. Uninstalling the module leaves the fields and their data in place.

Everything is read with PHP's own exif and IPTC functions, so exiftool is not needed. The module also provides:

  • drush photo-metadata:backfill to catalogue an existing library.
  • drush photo-metadata:coverage to report how much of the library carries usable metadata.
  • A photo_metadata migrate process plugin that reads the same values during an import.

Photo Metadata AI

Describes each photograph in one call to a vision model through the AI module. The model is either the one chosen in the module's settings or the AI module's default "Chat with Image Vision" model, so any provider the AI module supports will work.

One call returns:

  • Alt text, written with a " (via AI)" suffix. An editor removes the suffix on review, which marks the description as reviewed.
  • A caption and keywords, written only into empty fields.
  • The scene, plus the objects, people and named places, events or organisations in the picture. Each finding carries its own confidence score, and each named thing carries the evidence for it, such as a legible sign.
  • The full analysis as JSON, stored in a field.

Optionally, the description is written into the file itself as XMP and IPTC. The metadata is spliced into the file without re-encoding the image, and metadata already in the file from other tools is kept.

  • A subject context, set in the configuration, gives the model the library's own vocabulary.
  • The model is told never to name a person, and to name a place only from text legible in the picture.
  • The media item's title and folder are sent as background that is labelled as possibly inaccurate and not an instruction. Other modules can add background with hook_photo_metadata_ai_background_alter().
  • Uploads can be queued for description on cron.
  • drush photo-metadata:describe describes an existing library, runs several worker processes in parallel, and reports the tokens used so a sample run can price a full one.

Photo Metadata Picker

Adds a field widget, "Media library, with nearby photographs". It is the core media library widget plus a list of the photographs taken nearest to the content being edited, each with a "Use this photo" button. Selections go through the media library's own mechanism, so cardinality, access and validation all still apply.

  • The content's location comes from a geofield on it, including an unsaved value in the form, or from a geofield on an entity it references. The editor is told which one was used.
  • Sites can add their own location sources as tagged services.
  • Ships three admin views: a photo library filterable by keyword, date, credit and whether a photo has coordinates; a map of where photographs were taken, with Leaflet Views; and a worklist of photographs missing metadata. Uninstalling the module removes them.

Post-installation

  1. Enable Photo Metadata. Its fields are created once an image media type exists, and the keywords field also needs a tags vocabulary. To use existing fields instead, set the roles in photo_metadata.settings.
  2. Run drush photo-metadata:backfill to read an existing library, then drush photo-metadata:coverage to see what arrived.
  3. For descriptions, enable Photo Metadata AI, configure a vision-capable provider in the AI module, and set the model and subject context at Configuration » Media » Photo Metadata AI. Run drush photo-metadata:describe --limit=10 and read the results before describing everything.
  4. For the picker, enable Photo Metadata Picker and choose "Media library, with nearby photographs" as the widget for a media reference field in the form display.

Additional requirements

  • Drupal 11.2 or later and PHP 8.3, with the PHP exif extension.
  • Geofield.
  • Photo Metadata AI: AI 1.2 or later, and a provider module for a vision-capable model. It uses the imagick extension when present and falls back to GD.
  • Focal Point: its point is recorded with the other metadata and written into the file.
  • Leaflet: needed for the picker's map view.
  • Media Folders: a photograph's folder is sent to the model as background.

Known limits

  • XMP is not read. Lightroom and Apple Photos write captions and keywords to XMP by default, so copy them to IPTC before importing.
  • EXIF is read from JPEG and TIFF only. PHP cannot read metadata from PNG, WebP or HEIC.
  • A zero GPS fix is treated as no location.
  • Capture times are stored as the camera's clock records them, with no time zone.

Similar projects

  • Exif maps EXIF and IPTC tags to fields through widgets. It cannot write a Geofield, and it reads the file on every save. Photo Metadata can run alongside it.
  • Geocoder's file provider fills a Geofield from EXIF GPS. It does not read dates, cameras, captions or keywords.
  • AI Image Alt Text and the AI module's own Automators generate alt text. Photo Metadata AI returns alt text, caption, keywords and scored findings from a single call, marks descriptions that haven't been reviewed, and can write the result into the file.

How this module is built

Much of this module's code, tests and documentation was drafted with an AI coding assistant (Claude Code). The maintainers review, test and take responsibility for every change, and the tests and code checks run on drupal.org's CI. Contributions follow Drupal's policy on the use of AI when contributing.

Supporting this module

Developed and maintained by Tyler Brown Cifu Shuster of FivePaths, LLC. Development sponsored by FivePaths.

Drupal 11 · not 10 PHP >=8.3

Ask your assistant about Photo Metadata

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

  • Geofield
  • datetime Drupal core
  • image Drupal core
  • media Drupal core
  • taxonomy Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
5
Tracked since
Sep 2026
Latest release
2 days ago
Releases (12 mo)
5 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
1.0.1 Stable 11 PHP >=8.3 Nov 11, 2026
1.0.0 Stable 11 PHP >=8.3 Oct 20, 2026
1.0.0-beta2 Pre-release 11 PHP >=8.3 Oct 13, 2026
1.0.0-beta1 Pre-release 11 PHP >=8.3 Oct 5, 2026
1.0.x-dev Dev 11 PHP >=8.3 Sep 29, 2026