EXIF data in WordPress

You might have noticed that I’ve been talking more about the technical details of some of my photographs lately. I had a thought a while ago that it would be nice to be able to include the relevant details either automagically, or at least with as little effort as possible, and so I did some searching.

As WordPress saves the EXIF[1] data when images are uploaded, and makes it available for inserting into posts, this shouldn’t be too hard, I thought.

And indeed, there are several plugins which attempt to do that, but getting one that would play nicely with my other plugins proved to be more of a challenge. After trying a few which didn’t work for me at all, I eventually found Thesography by Krysten Symonds. This is nicely flexible – while it’s been written to work automagically for the well-known Thesis theme, it works perfectly well with a shortcode for any other theme.

There are options for formatting how it inserts the data – the default is an unordered list, which is probably what most people will want, and you can select which data you want to insert from a good selection of fields. The only one that I’d like to see that isn’t available so far is “Lens”, but otherwise it does the job.

The current version lists the values in a particular order that didn’t really work for me. This may be turned into a setting in a future version, but it was a simple task to cut and paste the relevant (and clearly marked) blocks of code into the order I wanted.

I then set up some CSS in my child theme to make the data display in a bar rather than as a list. This looks neater to me, and takes up less vertical space, so people who don’t want to know about that kind of thing can more easily ignore it.

Anyway, here’s an example of what you can expect to see from now on[2]. This is the sinister tower at Segedunum. While it does give an excellent view of the site, and indeed along the Tyne, it does look like it’s been placed there by our alien overlords.  :dizzy:

Segedunum Tower

Segedunum Tower

Camera Canon EOS 5D Mark III
Aperture ƒ/11
Shutter speed 1/250s
Focal length 70mm
ISO 200

After inserting the image in the usual way, I use a Textexpander snippet to insert this bit of code: [exif id="" show="camera,aperture,iso,shutter,focus"]

I find using a tool like Textexpander makes this kind of thing a lot easier, but you can type the whole thing by hand if you prefer. You’ll notice that there are two ” marks after “id” – that’s where I need to insert the unique id of the image, so the relevant data can be extracted from the database. If there is only one image in the post, the plugin will default to getting the data for that, so you may be able to omit that part. I’m keeping it in for consistency, if nothing else. Have a look at the plugin documentation for the values to use for “show”.

To get the image id, all I have to do is click on the inserted image and look at the status line at the botom of the edit box:

Image ID

In this case, the id is 21028, and that’s what I type between the quotes in the shortcode: [exif id="21028" show="camera,aperture,iso,shutter,focus"]

Which will output this:

Camera Canon EOS 5D Mark III
Aperture ƒ/11
Shutter speed 1/250s
Focal length 70mm
ISO 200

How that appears is entirely up to the user. I’ve gone for a look which fits in with the current overall appearance of the site.

Nice plugin, if you’re at all interested in showing off the gory technical details of your photographs, it’s well worth a try.

[1] If you don’t know, or care, what that is, bear with me, it gets more interesting later

One thought on “EXIF data in WordPress

  1. Pingback: EXIF Revisited : Losing it

Comments are closed.