Skip to content

EXIF Metadata in PhotoSwipe

Pierrick Le Gall edited this page Dec 5, 2023 · 9 revisions

You can show the the picture's EXIF metadata in PhotoSwipe. This feature is disabled by default, see Performance considerations

Name<->Tag mapping

It uses PHPs read_exif_data function through Piwigo's get_exif_data(), which requires a 1to1 mapping from tag names to EXIF fields. The default mapping should work for most vendor/lens combinations, with the exception of older Canon bodies/lenses. Implementing a proper exif extraction using exiftool or similar is beyond the scope of a theme, but at least you have an option to override the default mapping in local/config/config.inc.php.

$config['bootstrap_darkroom_ps_exif_mapping'] = array(
        'date_creation' => 'DateTimeOriginal',
        'make'          => 'Make',
        'model'         => 'Model',
        'lens'          => 'UndefinedTag:0xA434',
        'shutter_speed' => 'ExposureTime',
        'iso'           => 'ISOSpeedRatings',
        'apperture'     => 'FNumber',
        'focal_length'  => 'FocalLength',
      );

Do not change the keys on the left side, also adding new ones will have no effect.

Search & Replace filtering

Additionally, you can set a search & replace filter on each tag. This is handy if your camera vendor decided to set the "make" tag to "OLYMPUS IMAGING CORP." and you prefer it to be just "Olympus".

$conf['bootstrap_darkroom_ps_exif_replacements'] = array(
  'make' => array('OLYMPUS IMAGING CORP.','Olympus'),
  'lens' => array('iPhone 6 back camera','iSight Camera'),
  );

Performance considerations

Be aware that each images data is extracted from the file directly when the page is loaded (category, thumbnails, picture page). If you have albums with tens of thousands of images in one single album, this could cause your server to crash, burn your house, kill your cat, etc. You have been warned.

Clone this wiki locally