By the way, the travel log still lacks pictures, but that will change soon.
Update: Travel log entries with photos now have inline pictures.
I’ve spent the past two nights learning how to dynamically resize images in PHP, and image functions are harder than they look at first glance. You would think that it would be as simple as passing a filename string to a “resize()” function in a PHP file and linking to that file as an image. Oh no, you need to create a container object and copy an image into it and resample and specify about a dozen different arguments and return “image/jpeg” Content-type headers before you can even think of resizing a JPEG nicely without getting sickly green tones over it. If you’re lucky. More often you just get a black square.
After much hunting, downloading, trial, and error, this code snippet set me on the right path. It needed tweaking — imagecopyresize() kept pixelating until I replaced it with imagecopyresampled(), and the colors were completely whack till I discovered imagecreatetruecolor() — but I think I’ve managed to make a decent dynamic JPEG thumbnailer which will take just about any local image and resize it to a given percentage, all specified in $_GET. It’s what’s running the webcam shot in the sidebar right now.
I should have a code snippets repository around here, perhaps.