logo
  • Home
  • About
  • Plugins

Subscribe to Articles

WordPress 2.5 EXIF Fields

Author: andrew Category: Uncategorized Tags: plugins, Readers

Wednesday
Apr 2, 2008

When I reviewed the photo gallery theme on monday I pointed to my photoblog where I was using it as an example. In some of my posts I was displaying the photo’s EXIF data and today someone asked me how I did that. The answer to that question is that I wrote a script a while back to do it for me; however, WordPress 2.5 has new capabilities and one of these is extracting IPTC and EXIF data from photographs when they are uploaded. So I set about finding out how to access it.

So far I haven’t been able to find any specific functions for displaying the data that is generated. I guess this is what Matt meant when he tagged it as a bonus feature. If anyone has any ideas about displaying it using template tags then let me know, but for the time being I have written a small plugin to display that data.

Here is a sample below:


[photodata]

The plugin

Once downloaded and installed you need to include the following code in your post:

[photo-data:#]

Replace # with the ID of the attachement. This is easy to find by looking at the code that WordPress adds to your post. WordPress includes a class of wp-image-229, where 229 is the ID.

I have written this fairly quickly so it has been tested on one WordPress 2.5 blog: this one. I am happy to hear any suggestions about ways to improve it.

This has now been updated to take advantage of the shorttags in WordPress 2.5. It is also even easier to use because a URL can be passed instead of an ID. Please visit the link below for the read me file.

You can Download it here fun-with-photo-data


Share:
image image image image image

Comments

Chris Osborne (http://sapidexistence.com)

June 21st, 2008 at 8:22 pm

Is there a way to make this work with images hosted at Flickr?

Andrew Rickmann (http://www.arickmann.co.uk)

June 22nd, 2008 at 7:50 am

Chris,

This pulls data from the WordPress database. It doesn’t read any information from the images themselves and so won’t work with images from anywhere else.

Chris Osborne (http://sapidexistence.com)

June 23rd, 2008 at 5:36 am

I figured that was the case when I read, but I thought I’d ask anyway.

After looking around everywhere it seems that’s what all the plugins do. Just based purely on theoretical stuff, would it be easier for someone to work from this to get what I want or would it be better for me to start from scratch?

Andrew Rickmann (http://www.arickmann.co.uk)

June 23rd, 2008 at 7:15 am

Chris,

I don’t know how Flickr handles these kinds of things but as it resizes images it may or may not remove the information from the image, so perhaps it is possible to extract the information from the image, or perhaps you would need to interface with the Flickr API and see if it is possible to pull the information out that way.

Either way it is a completely different thing to what this plugin does so this plugin would be of no use as a starting point.

As this does is pull information from the WordPress database and put it on screen. The WordPress core does the real work.

Chris Osborne (http://sapidexistence.com)

June 23rd, 2008 at 12:44 pm

What fun. The people over at Flickr think that if someone wants to see the EXIF, they should go over there and see it. And I’d rather let people see it right from my blog.

Joshua (http://www.podq.com)

July 1st, 2008 at 10:59 pm

Andrew,
Fantastic plugin! I couldn’t figure out how in the world to have WordPress just do this itself, but this one works perfectly. What about the possibility of having it automatically insert the shortcode into any post that contains just one image, for example? (Just to save me some time! ;-)) Thanks again for the work!

SaƧ Modelleri (http://www.sacstilleri.net)

August 23rd, 2008 at 10:23 pm

Good plugin Andrew.Thanks.
I need it for my photo blog.

teknoloji (http://www.kimyazmis.com)

August 24th, 2008 at 2:05 am

I need it for my photo blog. :)

david smeaton (http://www.davidsmeaton.com)

November 16th, 2008 at 2:43 am

hey andrew, this is a great plugin!!! i love it because it's so simple … i'm the first to rate your plugin here, i gave it 5!! :)

i have a suggestion for future versions (i'm hoping you're going to continue updating this plugin). when the photo has no exif, it says 'no data available for this image', it would be great to have a check box on the options page to not show this comment. all of my digital photos have exif, but my film scans have no exif data. instead of showing a 'no data' comment, i'd rather it said nothing at all.

of course, i can comment that part out of the script (or change the comment to read nothing), but for simplicity it would be great to have a checkbox that gave the same option.

anyway, love your plugin … simple and useful.

thanks for your hard work.

cheers

david
http://www.davidsmeaton.com

Andrew Rickmann (http://www.wp-fun.co.uk)

November 28th, 2008 at 8:42 pm

David, I have update the plugin. You can now choose what message is displayed. If you wipe it so it is blank then nothing will be displayed, not even the title. The plugin page is here: http://www.wp-fun.co.uk/fun-with-photo-data/

travesti (http://www.travestitr.com)

March 13th, 2009 at 7:04 pm

thank you good


Premium iThemes Review: Photo Gallery
WordCamp is coming to the UK

Recommended

WP Remix Banner

Archives

  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007

Tags

2.7 2.8 Admin Advertising Air Blogging blogs Cache Cliche Coding Comments Content Types CSS Curry Death development Disqus Features Habari image Interview Licensing Modes Monday Poll New Features Organisation Personal Platform Plugin Plugin-Practices plugins Plugin update Poll premium Readers Reviews Search Simplification Snippets Spam Themery Themes tools User Interface Widgets WLTC

Copyright 2009 Fun with WordPress - All Rights reserved.

Wordpress theme by: WPUnlimited