Thesography
What is Thesography?
Thesography displays EXIF data for images uploaded with WordPress. It utilises WordPress’ own feature of storing EXIF fields in the database, and also enables import of latitude and longitude EXIF to the database upon image upload.
Thesography was originally meant for use with the Thesis theme from DIYthemes, thus the name, but I decided to make it useful for all WordPress themes.
I’ve been using EXIF display on my photoblog for some time. I’ve also written a couple of posts about EXIF with WordPress; Geo EXIF data in WordPress and Add image EXIF metadata to WordPress. Some people expressed a desire to see this functionality in a plugin without modifying WordPress files: this is it.
The purpose of this plugin is to make dislaying EXIF data as convenient as possible, while using as much of WordPress’ native image handling as possible — for convenience, forward compatability and because WP image handling has come a long way in recent years.
Download current version
Please leave praise, criticism and bug reports in the relevant thread.
Discussion threads
Installing the plugin
- Upload the thesography folder to your wp-content/plugins directory.
- Visit the plugins page of your WordPress dashboard and activate the plugin.
- Visit the Thesography Options page under Settings in your WordPress dashboard.
For EXIF data to display correctly it is essential to visit the options page the first time you activate the plugin; it is not essential to save the options, unless you change any of the defaults.
Display EXIF automatically
Automatic EXIF display only works with the Thesis theme (at this time) and will only show the EXIF for the first image attached to the post.
To automatically display EXIF data at the end of your posts with the Thesis theme you need to select the EXIF items you wish to be displayed. This can be done on the options page by selecting the default items for all future posts, and can be edited for individual posts in the Write panel.
Display EXIF via shortcodes
EXIF data can be displayed anywhere in your posts via shortcodes. Unlike automatic display, you can display EXIF for multiple images when using shortcodes by specifying the ID of the image.
Use the syntax [exif].
By default the shortcode will display all available exif items for the first image attached to the post.
Display certain EXIF fields
To select the fields you want to display use the attribute “show”.
[exif show="aperture,location,shutter"]
The following list contains valid arguments for the attribute “show”.
- all
- aperture
- credit
- camera
- caption
- time
- copy
- focus
- iso
- location
- shutter
- title
Display fields for specific (and multiple) images
To show the EXIF for a specified image and potentially multiple images within a post, use the attribute “id”. To show multiple images, use the whole shortcode multiple times with different IDs.
[exif id="457"]
You can find the ID of the image by viewing the HTML of the image inserted into the post, which will contain something like wp-image-457, where “457″ is the image ID. Or by finding the link to edit the image in the Media Library, where the end of the URL will be something like media.php?action=edit&attachment_id=457.
Add EXIF display to your theme
You may also add EXIF data to your theme manually using the function <?php echo display_exif($option,$imgID); ?>. This can be used within the loop, with or without an image ID, or outside of the loop if an image ID is provided.
The function accepts two parameters: the options for the EXIF items to display and the image ID. If no image ID is provided it will default to the first image attached to the post. The options parameters are the same as those for the shortcode parameters. By default, all available EXIF fields are shown when the function is called.
Display only some fields of the first attached image
echo display_exif('aperture,shutter,iso');
Display all fields of a certain image
echo display_exif('all',457);
or
echo display_exif('',457);
Display certain fields of a specific image
echo display_exif('aperture,shutter,iso',457);
Use options in post edit page
If you are using a theme other than Thesis, but would still like to use the options in the Edit Post page you can use the following code within the loop.
$exif_options = get_post_meta($post->ID, '_use_exif', true); echo display_exif($exif_options);
To use the above outside the loop, replace $post->ID with your required post ID and add the image ID to display_exif.
License
Thesosgraphy is licensed under the GNU General Public License.






{ 7 trackbacks }
{ 46 comments… read them below or add one }
Sweet plugin – I remember getting your help a year or so back now for use on my own blog! Just one small suggestion – perhaps you could include the option to display a Google Maps thumbnail similar to the one I used to have on my old site (screenshot here).
That would be a cool addition :)
Hey Ben,
Thanks! That is a good idea, which previously went fleetingly through my brain. I will definitely add something like that in a future version. Another thought I had is to add a map overlay.
Will see how this goes and what other kinds of requests I get.
This is so awesome! I’ve been thinking of adding a photo blog page to my site and this plugin is going to rock. Thank you! :)
Thanks RowdyKittens! Good to know someone is keen :-)
Hi Kristarella!
Thank you very much for this plugin, I was searching one for the EXIF data of muy photos y there is very few plugins about this features. That if the plugin works good, like yours :)
You wrote in my blog yesterday about the translation that I did in your plugin, This is what I did:
I edit the thesography.php, I have searched the string of “$exif_list = $before_block;” and I translate the exactly words that appear at the post. Not the admin and the post page where i write the posts. My knowledge of php (and English) is almost null :). If you want I can send you the part.
You ask me if you should do the plugin more accessible for non-English blogs. I think with a little English that the user knows the “Thesography Options page” is easy to manage. But always is better if the plugin is in your language.
You can always give the option for people to translate the text strings to your language using a single file containing those strings for example.
About the design if you want some advice I could tell some like… that the list of exif data were in a table of diferent color… (one color each row) or/and in two colum (and that the user could choose which in colum put them) for occupy less part of the post and stuck to the image, like a frame of the photo. All this with a CSS file that the user could edit for adapt the color at your blog.
Good, this are some ideas that I had now about your plugin I hope I have helped. I
I´ll use your plugin during some time from now in all my photos :D
Greets!
Thanks so much for the feedback Alejandro!
I will definitely include language files with the next release of the plugin. I don’t know if I will make the data into a table with included CSS, but I will write a tutorial about how to use the Options page and theme CSS file to customise the look.
Hi,
Great initiative, as EXIF seems to be totally ignored by most WP theme creators and incomprehensibly by the photo blog themes!!!
There is one major functionality missing – dispalying EXIF as pop-up only when user is mousing/pointing on the image, and thus only receives EXIF info when wanted. EXIF info is not interesting to the majority of visitors, and takes away space from the photo blog, as well as disturbs the visual ambience of the layout and photo.
Currently you only display the location data when the visitor mouse over the image. Half of this information is already in the title (Bridge at night), so why not use the location as the title, and instead display the EXIF when user points to the image?
Are you going to add this funtionality?
Regards
Morten Ross
YOu only have
Hey Morten,
Thanks for the feedback.
By pop-up, do you mean as a simple title attribute (displayed by most browsers as a small yellow box) or something a bit fancier, like a hidden box that fades in with javascript when you hover over the image?
The EXIF can easily be displayed as a title attribute by inserting the shortcode into the title attribute when editing the post in HTML mode. It would look something like like:
<img src="http://www.example.com/image.jpg" alt="Example Image" title="[exif id="3520" show="all"]" width="800" height="500" class="frame size-full wp-image-3520" />To do that you would want to change the default settings for how the exif is displayed so that there is no HTML, perhaps just separate the items with commas and a space.
Not sure what you mean about the location data: on that photo you mention it says “Sydney Harbour Bridge at night” upon hover because that’s what I named the image in the WordPress gallery (so WP gave it that as a title attribute), but I only titled the post “Bridge at night”. The location data is in the list below the photo with all the other exif; it shows the latitude and longitude and links to Google maps.
Hi,
I would most definitely prefer your latter suggestion – “like a hidden box that fades in with javascript when you hover over the image”. This is how Jalbum has had it for many years.
Since you have the name of the place partly in the file name and in the title it’s rather fragmented. Either all the info should be in the file name or in the title not 50% file and 50% title.
I think the title should contain the full description, and the hover-info should contain all EXIF.
Is this something you will or can work on?
If you see my Jalbum-based photoalbum, EXIF is displayed either as a slide-in data sheet when you point on image, or as a sticky board: http://www.ross.no/photogallery/
I tried your shortcode, but to no avail, so I do not know how this would look. Will it come all on one long line, or will it be displayed as a list?
How do I change the default settings for how exif is displayed?
PS: I use Woothemes’ Aperture.
Morten
Morten — had trouble seeing what you meant about Jalbum at first, it doesn’t work properly at all in Chrome.
The file name and title stuff has nothing to do with the plugin and everything to do with how I handled the image while I was posting it. I merely gave the image a slightly more descriptive title than I gave the post, there’s no 50-50 about it, all the technical data is still in the EXIF. It would be similar to naming a post “Flowers in spring” and then showing an image with a title attribute “Cherry blossom tree”, it’s just more specific.
The markup used to display the EXIF can be edited on the Thesography Options page under “Your custom HTML”. By default it is displayed as a list; if you were to add it to the title attribute of the image you would need to remove the
<ul class="exif">and all the other HTML bits and just use a comma to separate the items. If it’s not displayed in the title attribute then any HTML format can be used.I don’t know if I would want to include a fancy javascript display with the plugin because the behaviour and style of such a thing would vary so greatly from theme to theme and user to user, as well as introducing a bunch of accessibility questions. E.g., if the EXIF is shown in the post, but hidden and displayed with javascript, should it be in the RSS feed? And, what if someone is viewing your site on their mobile and have no hover action, should they just not be able to see the EXIF?
It would be quite simple to implement a javascript EXIF display on your own blog. As long as the EXIF is displayed successfully to begin with, you could pop a bit of jQuery in the head of your site and a bit of CSS should give you the effect you’re looking for. I’d be happy to write a tutorial on it, but I don’t want to rush into including it in the plugin itself until I’ve figured out how to make it as flexible as possible to suit most users’ needs.
Hi,
Chrome is not a problem – I use latest version of Chrome and the Jalbum at http://www.ross.no/photogallery works like a charm. Do you have problems with your version of Flash?
It also works in Opera, firefox and Internet Explorer.
I have tested it further and got the exif to be displayed as a context pop-up/title attribute but rather than as a list, it’s all on one line. What do I use (in Thesography Options) to force line feed after each exif item (name + value)?
Then comes the major obstacle:
As images in Aperture are displayed via a custom setting in Aperture theme using an url like “http://www.ross.no/communicate/wp-content/2009/10/DSC_0336b.JPG”, it’s not possible to add attributes, as far as I know at least.
I can supply screenshots of the Aperture settings page if necessary.
As long as images are supplied inside the post itself, this will w ork in “Aperture-land”, it seems…
Looking at your http://www.kristarella.com/the.....ode-params,
and “Use options in post edit page”:
$exif_options = get_post_meta($post->ID, ‘_use_exif’, true);
echo display_exif($exif_options);
Which file should this go into?
BTW: It also displayes non-checked item “Taken” which should correlate to “Creation time” which I have not selected.
Morten
Morten — I was using Chrome on mac, it’s still in the developer stage, so it can be buggy, just thought I’d mention for future reference in case you ever see a problem.
You can’t have line breaks in the title attribute; I’m afraid they’re very limited.
As long as the images have been uploaded by WordPress, the EXIF will be accessible to Thesography. The best way to insert the Thesography code varies for different themes and different user purposes.
If your theme uses hooks (I don’t think WooThemes do) it can go in functions.php in the theme folder to be inserted within the theme. Otherwise it needs to go straight into the theme template files in “the loop”: between
while (have_posts()) : the_post();andendwhile;(or they might use{instead of:and}instead ofendwhile;). This will display the EXIF for only the first image attached to every post. For showing the EXIF for multiple images, shortcodes must be used in the post with the image ID and specifying which EXIF to use.Did you want me to write a post about making a javascript popup?
If you’ve only used the shortcodes so far, they do not utilise the default checkbox options for which EXIF fields to show (they’re designed so that they can be used for multiple images in a post and showing different sets of EXIF, if needed).
Hi again,
OK, title attribute is a dead end, as info can only be on one line. Also the shortcode is not really viable as it can only be used in the posts, and in my posts the majority only have one photo, and that is controlled by Aperture theme. Even though all h ad more than one photo, it would look lame with exif only on photo # 2 and onward.
Seems javascript is the only way, unless you would like to join the WooThemes community :-) ?
They still don’t know how to incorporate this into their themes, but there are many users that really want this…
I’m definitely interested in seeing what you have on making a javascript popup, so much appreciated if you would like to elaborate :-)
Morten
Hi Kristarella!
I just updated my plugin (1.0.1) and I had a new idea for future version of the plugin!
At the plugin page admin you could put a “menu” so the user put in order that he likes the data exit in the post.
Pardon but my english tonight is… very bad xD
One kiss
Morten — Sorry for the delay, I didn’t get your comment on email, or lost it when my browser crashed or something and only realised you’d made it later.
I just published a post about javascript popups with Thesography.
In the Aperture theme, do you still have to upload the photos via the WordPress uploader? If so, you should be able to retrieve the image ID and insert the EXIF for the image at the start of the post via the shortcode. Then, even though the image is displayed by the theme using a custom field, it will be just before the EXIF data in the HTML and the javascript I wrote will be able to find it and show/hide it.
Alejandro — Thanks for the suggestion. I will think about how I might go about doing that.
Also, making a language file for the plugin is high on my list of priorities! I spent most of Friday trying to make one, but the software I tried was not working. It should be there in the next update though.
Hi,
I think the need for the user to both find and enter the image ID is cumbersome and very time consuming. Just think of those who’s got hundreds of posts and photos that must be edited to include this information. The image ID could be retrieved using a variable, and thus be generic.
I think the best approach and logic would be:
1: Detect if user is pointing mouse over image (allready in place by you)
2: When yes – retrieve the image id. Using image id variable, not actual id, to automate – e.g [exif id=%Image_ID%]
3: display Exif either below image or via Java popup according to user’s preference (allready in place by you)
Regards
Morten
Morten — It is easy to find the image ID by inserting the image into the post, the ID is shown in the class
wp-image-ID. It is an unfortunate step for those who weren’t already going to insert the image using the conventional method, I agree.I would never suggest that anyone edit their old posts to include the shortcode. The plugin, with its limitations as it now stands, would be useful for future posts using the shortcode. Or as I’ve mentioned in the documentation, for the first image attached to old (and future) posts if you put the
display_exif()function in your theme files.The only information accessible to the javascript (since it is only active after the page loads) is whatever is in the HTML of the page. However, all of the Thesography processing, and your theme processing, happens before/while the HTML is rendered, and independently of each other. So, the theme doesn’t make the image ID available to the javascript. Meanwhile, Thesography does get the ID of the first image automatically if you insert the code in the loop, but only the first image attached to the post because if it did more than that it wouldn’t know where to place the EXIF data in the post (it knows the images are attached to the post, but doesn’t know if they are rendered in the content of the post).
I’m not sure if what you’re asking is possible. It’s entirely possible to write a theme that does what you’re asking, but it sounds like your theme might be straying far enough outside the normal workings of WordPress that I can’t externally influence it in the way you’re describing. I will keep thinking about it though.
Morten — Just realised… The default action for Thesography when no image ID is provided is to use the first image that was uploaded/attached to the post. If the first images in your posts are the first ones uploaded then you don’t need to find their ID, Thesography already knows it. You would only need to find the ID of the subsequent images in the post to show their unique EXIF, which is not so hard because you just look at
wp-image-IDin the HTML view when editing the post.I haven’t tested it this way, but you should be able to use Thesography without an ID for the first image and then with IDs for the rest. And that would include inserting the
display_exif();at the start of posts in the template file (this is the instance without ID) and then use the shortcode in-post when you have a post with multiple images.Hi,
Where excactly do I put “display_exif(); ” – which template file are you referring to?
Does this work with your java popup?
Morten
Morten — The info for the usage of the function is above. It goes within the loop. The location of the loop might vary from theme to theme. Usually it will be in index.php or single.php for a single post page.
It will work with the javascript if you’ve visited the Thesography options page as per the installation instructions.
Hi,
Sorry for being dim, but when I put the code in the loop (line 3 in single.php) the code and not the value is displayed in the post.
See my single.php in a separate mail to you.
Morten
Would it be at all possible to cycle through each image in posts and insert the shortcode automatically after each element, using its ID (or rather, class, like wp-image-12)? I’m developing a photoblog theme that allows multiple photos in each post, and I’d rather not force the author to automatically enter the shortcode and image ID in their post.
Thanks for the great work!
Gavin — I’m not sure if any of the discussion with Morten above will help or process ideas for you, but in short, no. Unless you’re automatically inserting those images into the post through your theme according to the images attached to that post, then there’s no way (that I know of) to automatically add the EXIF for multiple images. The reason being that Thesography collects the EXIF data from the database according to the images attached to the post, but the user can add whatever images he wants into a post, in any order, whether they’re attached to the post or not.
In theory I suppose you could write a script that checks through the contents of the post, finds something that looks like
"src="http://image.jpg"then try to match that image URL to the post meta data and get the image ID and then get the EXIF. However, that is purely hypothesis at this point, I don’t know if it would work.Gavin — Missed the bit about doing it by classes… That might be a bit easier than what I said above because it doesn’t require matching against the database, but still it’s a bit of PHP that I can’t come up with off the top of my head. You might be able to do that, it would involve getting
the_content()as a variable, searching forwp-image-*in it, making that a variable from which you extract the numbers and then after the next line break insert the shortcode.Take this tutorial for example, if
$str = the_content()and$pattern = "wp-image-" . "([0-9]+)"(not sure if my regular expression is correct there, but it’s along those lines) then you would search for$patternin$str. I’m afraid that’s about the pointing and waiving of hands that I can do on my limited internet connection at the moment. Hope it was useful in soem way.hi Kristarella,
first of all, my compliments for this great plugin! I got it working perfectly also with the jquery hover box. my only questions is, if there is a possiblity to use a different order for the EXIF items other than the default alphabetical one?
many thanks in advance for your help.
greetings,
Alex
Alex — Great that you’ve got it working! Alas, there is no custom order of EXIF items as yet, but it’s a great idea and I’ve added it to my list of things to add. For now the only way to rearrange it would be to rearrange it in the plugin file itself.
Hi,
I’m using Wordpress 2.9.1 and before activating you plugin, I was able to upload photo’s using the standard Wordpress functionality. After activation of the plugin, the upload just stops during the crunching process of the uploaded image.
Is your plugin ready for use with WP2.9.1?
If not, will you be updating your plugin so it can be used?
If yes, what could be the problem?
Best regards,
Wessel
Hi,
I’m also using WP 2.9.1 and do not have any problems uploading images with Flash or default method.
Does it fail also with a small 100Kb sized image?
If you enable PHP error messages, you should see the error.
Morten
Wessel — I haven’t checked Thesography with WP2.9.1 yet. I was without internet for about a month when WP2.9 and 2.9.1 conveniently came out. I will be updating the plugin and making sure it all works, but I don’t know when I’ll be doing that.
There are lots of causes for the upload to pause in the middle of crunching, including a very large image (they usually fail to crunch at all between 1 and 2MB, or smaller if it’s a poor internet connection), a server with little processing power, exceeding the server’s PHP memory limit etc.
Morten — Thanks for your response! Glad to hear it’s working, at least on some servers.
Yes, I´m too in WP 2.9.1 (linux @ aruba.it) and It´s working :)
Hi Kristarella and Morten,
I found out that it wasn’t the plugin causing this behaviour. It has everything to do with the theme I used. This theme prevented me from uploading images in combination with your plugin. The theme also prevents that the exif metadata is put in the database. As soon as I switch to the default theme I’m able to see the EXIF information in the database.
Thanks for the replies.
For some reason 1.0.1 and WP 2.9.1 isn’t working together for me. When I activate it I can not access my Admin.. I have to goto PHPAdmin and deactivate the plugin manually to get back in to the Admin.
Scott — Sorry for the trouble, I don’t know why that would be. To be honest I haven’t had the chance to even upgrade my own sites yet, let alone test the plugin. A couple of people have said above that it’s running fine for them. Can you let me know what other plugins you’re running and your host stats (i.e. version of PHP, version of mySQL, operating system on server, or if you don’t know that just who the host is). It could be an incompatibility with another plugin. Is it only the admin that you can’t access, nothing else of the site goes down? Do you see any error messages? Does your host keep error logs?
No worries :-)
My host is Dreamhost
WP 2.9.1
The site doesn’t go down, just the admin sections. Here is a list of all of my plugins.. Not all are activated because of incompatibility
After The Deadline, Akismet, Contact Form 7, DISQUS Comment System, FancyBox for WordPress, FreeCharity.org.uk WordPress Petition, Google XML Sitemaps, Page Links To, Popular Posts, Post-Plugin Library,Really Simple CAPTCHA, Similar Posts, SlidePress, Thesis OpenHook, Thesography, WP-Cycle , WP-DBManager, WP-Optimize, WP-SpamFree, WP Lessn, WP Shopping Cart, WP Smush.it, WPtouch Phone Theme, WP_Auctions
I’m also using the plugin “Better Plugin Compatibility Control” to test compatibility
Scott — Thanks for that. I have another report of issues including error messages, so hopefully I can pin the problem down, although at a cursory glance Thesography shouldn’t invoke those files in WordPress at all. I will work on the problem as soon as I can (in the morning I hope), but for now it seems Thesography 1.0.1 is only working on some WP 2.9.1 installs.
No rush, the plugin does rock!
Hi,
I’m very excited about your plugin, great work. Only one thing that I would like extra. Is it possible somehow to have the date of the (first) picture as the post date?
Greets, Wessel
Hi all, there’s an update for Thesography coming through. It was causing an error related to internationalisation files in WordPress 2.9.1, but it only seemed to happen on new installs of Thesography, at least when I tested it. This should be fixed now.
Wessel — Not really, unless you edited the post date manually in the Edit Post dashboard. For visual purposes you could display the image date instead of the post date on your posts by adding
echo display_exif('time');to your template, but WordPress would still be taking the post date into account for chronological order purposes.Oops! Forgot to mention that there are now localisation files in the languages directory of the plugin, so folks like Alejandro can more readily change the language of the plugin output. Check out Poedit if you want a visual editor for the file and need to create a new .mo file.
The new version worked for me!
Hi, kristarella! ;)
Thanks for the languages files :). I have the Poedit already and I have translate some sentences (I´m new in this programm).
I have saved the .po file and .mo file automatically is update with the new text. In this moment I upload the files to my server and I dont see the translations.
Do I have to do something to see the translation? Renaming the files?
I hope you can help me and we translate the plugin to more languages :)
Alejandro — I’m a bit new to this whole thing, but in this tutorial there’s a bit at the end about translating. You might need to save your file as thesography-es_ES.po (and the automatically generated .mo as well) if you have your WordPress install set to Spanish.
Hi again:
Nothing, I had been all morning with the po and mo file and the translation doesnt work.
I’ve renamed (thesography-es_ES. *, en_ES….) and nothing. I have also searched in internet about the and I have found few things. Something like that the .po or .mo file must be together with the .php file but nothing. Or even I left the spanish version alone and doesnt work
I will continue searching and I´ll notify you when it´s works or find something.
Bye bye
P.D. I sent you the unfinish version of spanish to your email for if tou want try it in your server.
Alejandro — I didn’t have much know-how to test with, but perhaps the language files are not pointed to correctly in the plugin? On line 30 changing
$plugin_urlto$plugin_url/languages/might help. If you want to try it let me know how it goes, otherwise I will try more testing when I can.Thanks for the advice, but it doesnt work. I´ll continue searching.
Thanks for everything :)