Photo Metadata
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, thenDateTimeDigitized, then IFD0DateTime. - 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,ypercentages, 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:backfillto catalogue an existing library.drush photo-metadata:coverageto report how much of the library carries usable metadata.- A
photo_metadatamigrate 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:describedescribes 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; and a worklist of photographs missing metadata.
Post-installation
- Enable Photo Metadata. Its fields are created once an
imagemedia type exists, and the keywords field also needs atagsvocabulary. To use existing fields instead, set the roles inphoto_metadata.settings. - Run
drush photo-metadata:backfillto read an existing library, thendrush photo-metadata:coverageto see what arrived. - 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=10and read the results before describing everything. - 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 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.
Recommended modules/libraries
- 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.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.0.x-dev | Dev | 11 | Sep 29, 2026 |