Creating a photoblog with WordPress

While I updated shutterclicks to the new layout I switched it over to WordPress from Pixelpost. While Pixelpost wasn’t exactly unsuitable for what I wanted, its comment handling and generally very ugly codebase had me going nuts whenever I needed to do any maintenance on the site.

I’m now using a very bare bones install of WordPress with the Yet-Another-PhotoBlog plugin. And SpamKarma for spam filtering (which works much better than Akismet in my experience). I’ll probably look into other plugins to use on shutterclicks as well once I get all of the Pixelpost content moved over to WordPress. I used the import script from Shifting Pixel to do the base work.

However, it had problems in importing the images and embedding them in the correct post so I need to do some manual work as well. Which is to the better, since I’d need to fiddle around with the images to get them working with YAPB anyhow.

While YAPB has all of the documentation needed to get it going, it still needs some thought before it is fully functional. Unless of course you let it do all the necessary code injection of the pictures (which I naturally don’t). For example, there’s no template tag to insert the picture itself without any thumbnailing so you have to use some code for it. The following does the trick well enough:

Also, the EXIF output is quite horrible and needs formatting to be more readable. Well, that’s all IMHO ;). But I’ve never liked to see EXIF data displayed as it is on many websites in the very mathematic way (with lots of precision in the numbers etc). Rather I like to see it similar to the camera display (and how Lightroom shows it). So I wrote the following code to customize the EXIF output:

	if ($exif = ExifUtils::getExifData($post->image)) {
		echo '
    '; if (!empty($exif['model'])) { echo '
  • ' . $exif['model'] . '
  • '; } if (!empty($exif['exposureTime'])) { $time = $exif['exposureTime']; $i = strpos($time, '('); $j = strpos($time, ')', $i); $time = substr($time, $i + 1, $j - $i - 1); $t = explode('/', $time, 2); if (empty($t[1])) echo "
  • $time s
  • "; elseif ($t[1] == 1) echo "
  • $t[0] s
  • "; else echo '
  • ' . $t[0] . '/' . $t[1] . " s
  • "; } if (!empty($exif['fnumber'])) { echo '
  • ' . $exif['fnumber'] . '
  • '; } if (!empty($exif['isoEquiv'])) echo '
  • ISO ' . $exif['isoEquiv'] . '
  • '; if (!empty($exif['exposureBias'])) { $ev = $exif['exposureBias']; $i = strpos($ev, '('); $j = strpos($ev, ')', $i); $ev = substr($ev, $i + 1, $j - $i - 1); $ev = explode('/', $ev, 2); if ($ev[0] == 0) $ev = '0'; elseif ($ev[1] >= 10) $ev = $ev[0]/10 . '/' . $ev[1]/10; else $ev = $ev[0] . '/' . $ev[1]; echo "
  • $ev EV
  • "; } if (!empty($exif['focalLength'])) { $mm = $exif['focalLength']; $i = strpos($mm, ' '); $mm = substr($mm, 0, $i); $mm = round($mm, 0); echo "
  • $mm mm
  • "; } if (!empty($exif['flashUsed'])) echo '
  • Flash: ' . $exif['flashUsed'] . '
  • '; echo '
'; }

That code still needs some work, I’m not satisfied with how the exposure bias is displayed (3/3 when I’d like +1 in those cases). But at least it’s a step in the right direction.

4 thoughts on “Creating a photoblog with WordPress”

  1. You’re invited to do some suggestions – in particular if you have some working code as discussion basis ;-)

    One possibility would be to make a little wp-plugin which uses the build in “yapb_get_exif” wp-hook which gets called in the yapb_get_exif template function ;-)

    Greets from Salzburg,

    Johannes

  2. I’ll have to look into some ideas I have once I wrap up a few current projects that I have going on…

  3. it looks like i have finally come across someone with the same issue, i’m curious where i install this code though (i’m no code expert!)?? this looks different from the coding in the main template file. thanks!

  4. @skevbo: Sorry that it’s taken me so long to reply, business trips and vacation time is my only excuse.

    I honestly don’t remember where I put the code. I’ll be working on the layout of another photoblog (and updating my own soon), so I’ll post better documentation on my changes then (and check to see what is needed when compared to the current version of YaPB).

Leave a Reply