Walker News

How To Display WordPress EXIF’s Shutter Speed As Fraction?

Every photographers read shutter speed in fractional form, unless it’s slower than or equal to 1 second.

Why it’s like that? Well, I figure out that is probably easier to interpret speed in fractional form at a glance for most people (especially artists, not scientists). Isn’t easier to tell difference between 1/100 and 1/4000 than reading 0.01 and 0.00025?

However, the WordPress Gallery stores the EXIF’s shutter speed as decimal figure in database table. Apparently, computer programming is easier to deal with decimal than fractional.

So, in order to follow photography’s convention, there must be a way to render the decimal form of shutter speed stored in WordPress EXIF table in a fractional figure.

Unfortunately, there is no documented WordPress function to do this job (except the wp_get_attachment_metadata function), not even available in the latest WordPress 2.8 release.

Unless using WordPress plugin, you will have to create a image.php template file for the active WordPress theme, with a block PHP code to display decimal shutter speed as a fraction, if the speed is faster than 1 seconds; otherwise, the shutter speed should be displayed in integer or decimal form.

Sound scary? No worry, Andrew Kniowski figured that out and share it in his post titled Quick shutter-speed fix for WordPress EXIF.

I applied that code in my WordPress theme, but purposely removed this if-statement and hit a “divide by zero” error (for those photos without shutter speed or no EXIF data at all, e.g. screenshot):
 if (!empty($imgmeta['image_meta']['shutter_speed']))

After discovered that error, I put it back and now the screenshot looks better.

Custom Search

2018  •  Privacy Policy