WordPress.org

Ready to get started?Download WordPress

Forums

File Gallery
[resolved] EXIF in template? (5 posts)

  1. hungrycactus
    Member
    Posted 2 years ago #

    Hi,

    Is it possible to extract the EXIF from the photo into the template? I tried modifying the gallery.php template, but could not figure out how to get it from (http://www.bloggingtips.com/2008/07/20/wordpress-gallery-and-exif/).

    Much thanks!

    -Ethan

    http://wordpress.org/extend/plugins/file-gallery/

  2. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    hi ethan :)

    in the template, use the following code to get the EXIF data:

    $image_data = wp_get_attachment_metadata( $attachment->ID );
    $image_meta = $image_data['image_meta'];

    and then you will be able access the following properties:

    $image_meta['aperture'];
    $image_meta['credit'];
    $image_meta['camera'];
    $image_meta['caption'];
    $image_meta['created_timestamp'];
    $image_meta['copyright'];
    $image_meta['focal_length'];
    $image_meta['iso'];
    $image_meta['shutter_speed'];
    $image_meta['title'];

    `

  3. hungrycactus
    Member
    Posted 2 years ago #

    Thanks so much! That worked perfectly!!!!! =) =) =) =) =)

  4. electrolund
    Member
    Posted 2 years ago #

    Aesqe, as I'm understanding your suggestion, this will only allow us to insert EXIF meta into a full gallery insertion, correct? In other words, when inserting a single photo, there currently is no way to get EXIF data inserted into the caption or description?

    If that is correct, I guess this is more a complaint with WordPress' media library and not offering more flexibility with EXIF at the time of importation.

  5. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    @electrolund: take a look here: http://regex.info/exif.cgi?dummy=on&imgurl=http%3A%2F%2Ftodayilearned.co.uk%2Fwp-content%2Fuploads%2F2011%2F09%2Fcat-makes-friends-with-a-baby-deer-in-Odessa-zoo-in-Ukraine.jpg

    EXIF data from this particular image is copied to attachment title and description correctly when uploaded via WordPress.

    The function responsible for parsing EXIF data is wp_read_image_metadata.

    See the "Return Values" section to see which EXIF values translate to which attachment fields.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic