Random photo slider miniproject

In brief:

Look it: 25 random images from my photoblog slideshow

Mind you:

It doesn’t work in Chrome or Safari (and probably others…), some images will break (cos they’re too big to be resized), some are pixelated (cos they were too small), some aren’t cropped well (cos they’re square or portrait), and the idea is you have a fairly large monitor to see them properly in the first place.

Techyish stuff

Not sure if this is of interest to anyone at all but I thought I’d post it anyway… I’m coming up to the 300th photo on my photoblog (and just hit 13,500 on Flickr…) I’d have more on there but it takes 10 minutes or so for each new post and I’ve been wondering for a while if there’s a way to do it with the tim-thumb.php script rather than using WordPress’ in-built resizing tool and custom fields. Anyway, that’s an issue for another day which, using what I learnt today, should be fairly simple.

So I wanted it to slide from one post to the next rather than load a whole new page. I’ve made inroads today.

It uses:

  • jQuery + jFlow for the slider: http://plugins.jquery.com/project/jFlow
  • A new variable for the WP Loop I’d not heard of before: ‘orderby=rand
  • substr – a php command that lops a given number of characters off a string (such as the URL of the photo), then concatenates the tim-thumb resizing bit on the end.

post->ID, 'category');
$recent = new WP_Query("showposts=25&orderby=rand"); while($recent->have_posts()) : $recent->the_post();?>

<a href=""> $newstring = substr($string, 0, -12).'.jpg';
echo $newstring; ?>&h=750&w=950&zc=1" alt="" />

And that is what passes for excitement during the week in Brunswick, Maine.