Support » Themes and Templates » Retrieving Exif Data

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    This website should help you out: http://www.bloggingtips.com/2008/07/20/wordpress-gallery-and-exif/

    Thank you,

    Thanks for that i_g_wright, I have read that through several times, and tried most of what is suggested, but it only seems to work in the context of a gallery which is not what I am trying to do.

    What I am trying tp do is have a single post with a photo and the exif data next to it with next and previous links to work forwards and backwards through the images. At this point everything I try returns no information at all. My thinking is that when WP (on uploading) creates smaller images it wipes out the exif data on these smaller images, which has to be retrieved from the original image, and that is what I can’t get my head around right now.

    Hi,

    Ok, in your single post template (PHP file) you should be able to use the following code:

    <h1>Attached Images & Exit Data</h1>
    <?php
    $args = array(
       'post_type' => 'attachment',
       'numberposts' => -1,
       'post_status' => null,
       'order'	=> 'ASC',
       'post_parent' => $post->ID
      );
    $attachments = get_posts( $args );
         if ( $attachments ) {
            foreach ( $attachments as $attachment ) {
               $imgmeta = wp_get_attachment_metadata( $attachment->ID );
               echo '<pre>';
               print_r( $imgmeta );
               echo '</pre>';
              }
         }
    ?>

    This code will print out an array of all the image sizes available and the image exif data.

    To print out each item separately you can use the following formats (As stated from the website above)

    $imgmeta[‘image_meta’][‘aperture’]
    $imgmeta[‘image_meta’][‘credit’]
    $imgmeta[‘image_meta’][‘camera’]
    $imgmeta[‘image_meta’][‘caption’]
    $imgmeta[‘image_meta’][‘created_timestamp’]
    $imgmeta[‘image_meta’][‘copyright’]
    $imgmeta[‘image_meta’][‘focal_length’]
    $imgmeta[‘image_meta’][‘iso’]
    $imgmeta[‘image_meta’][‘shutter_speed’]
    $imgmeta[‘image_meta’][‘title’]

    I hope that helps,

    Thanks i_g you’re a genius, that works perfectly…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Retrieving Exif Data’ is closed to new replies.