Jan 08 9

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:

<img src="<?php echo $post-/>image->uri ?>" width="< ?php echo $post->image->width ?>" height="< ?php echo $post->image->height ?>" />

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 '
<ul class="exif">';
		if (!empty($exif['model'])) {
			echo '
<li>' . $exif['model'] . '</li>
 
 ';
		}
		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 "
<li>$time s</li>
 
";
            elseif ($t[1] == 1)
                echo "
<li>$t[0] s</li>
 
";
            else
           		echo '
<li>' . $t[0] . '/' . $t[1] . "&#x00A0;s</li>
 
 ";
		}
		if (!empty($exif['fnumber'])) {
			echo '
<li>' . $exif['fnumber'] . '</li>
 
 ';
		}
		if (!empty($exif['isoEquiv']))
			echo '
<li>ISO&#x00A0;' . $exif['isoEquiv'] . '</li>
 
 ';
		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 "
<li>$ev&#x00A0;EV</li>
 
 ";
		}
		if (!empty($exif['focalLength'])) {
			$mm = $exif['focalLength'];
			$i = strpos($mm, ' ');
			$mm = substr($mm, 0, $i);
			$mm = round($mm, 0);
			echo "
<li>$mm&#x00A0;mm</li>
 
 ";
		}
		if (!empty($exif['flashUsed']))
			echo '
<li>Flash:&#x00A0;' . $exif['flashUsed'] . '</li>
 
';
		echo '</ul>
 
';
	}

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.

Jan 08 9

Randomfire updated

I finally got around to changing the layout of the site. Anna designed the holy trinity layout for all three of my blogs (randomfire, randomfire: shutterclicks, and Satunnaisia leiskahduksia) some time ago. Now two of the three have been switched over to the new layout and the latest version of WordPress.
There’s still some work I [...]

Continue reading Randomfire updated »

Nov 07 9

Amused by The Times

I’ve always respected The (London) Times and the writers it uses. But today I can’t help but be amused by the commentary of the Jokela shooting (massacre ?) by Roger Boynes. Oh, he sure does use all of the correct clichés when writing about Finland: its darkness, sparse habitation, suicide rates, gun ownership, and our [...]

Continue reading Amused by The Times »

Nov 07 2

Background images and tables

In developing a new version of our website (our personal site), I encountered an odd bug that seems to affect IE6, IE7, Safari 3 (beta, windows) and Konqueror 3.5.6. Opera 9 and Firefox 2 at least are unaffected by the issue.
The issue comes from having a semantically marked up table in which a tbody is [...]

Continue reading Background images and tables »

Oct 07 31

A long hiatus

I’ve really been neglecting all of my blogs this year. Earlier this week I vowed I’d change this. So if I do have any readers left, be prepared to finally see more frequent posts and a change in the layout sometime (hopefully soon) in the future.
I really have more than enough ideas on what to [...]

Continue reading A long hiatus »