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.
As of version 1.0.3 you can now turn automatic insertion off. Use this if you would like to use the default display options with manual insertion. The code for manual insertion using the options is below and discussion of custom insertion on certain pages is in the v1.0.2 discussion thread.
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
.
Localisation
As of version 1.0.3 Thesography now has proper language support.
Big thanks to Alejandro Herroro for working out the bugs with language file referencing in v1.0.2.
Download language files
Spanish — courtesy of Alejandro Herroro
License
Thesosgraphy is licensed under the GNU General Public License.