peteg's blog - noise - blogging - img - 2007 01 03 img

Blosxom plugin: img

/noise/blogging/img | Link

(or: reinventing PLog, one piece at a time.)

I wanted to add images to the blog, and as I'm fed up with ImageMagick I was relieved to find that someone has written a more usable replacement for perl called Imager. You'll need to install that first, and it should be as easy as politely asking CPAN to do it for you. Also you'll need interpolate_fancy so you can invoke the method in your stories. Here's the code:

The instructions are in the script. It's still quite rough, and I'll be updating it as I go along. Take a good look at your error logs if things don't work.

The existing Blosxom image plugins are a lot fancier than this; I just wanted something that generates thumbnails and automatically adds the requisite attributes to the img tag. This photo is from my trip up to Berilee last month — if you squint you can see the car ferry at Berowra Waters. The markup is:


<@img.img src="IMG_1667.JPG"
 style="border-style: none; margin: 0 0 10px 10px; float: right; clear: right;" />

which, when run on my iBook, results in the XHTML:

<a href="http://localhost/~peteg/images/IMG_1667.JPG"><
 img src="http://localhost/~peteg/images/cache/tn_IMG_1667.JPG"
 width="93"
 height="70"
 style="border-style: none; margin: 0 0 10px 10px; float: right; clear: right;"
 alt="" /><
/a>

I get the impression that the interpolate_fancy plugin doesn't like having newlines in the arguments.

...and yes, I am vaguely aware that those suckling on the RSS nipple are not getting the full technicolour experience. Bear with me.