Thanks everyone for the feedback. Yes, there are plenty of ways to improve this, and a Wordpress / Typo plugin seemed logical to me, as well as adding support for alt / title attributes on the images.
The speed of getImageSize() hadn’t worried me too much as benchmarking didn’t show too much of a performance hit (compared with my first attempt at least). I’ll certainly look into getting the data from the image resource if this saves some processing power.
It currently tries to use the highest resolution image as the large one, but an obvious enhancement would be to add an extra flag for priority on each image.
I guess the whole point of the script for me is to deal with user uploaded images, or images that change often - The script works very well for a homepage rotation, where 3 random images are chosen randomly and arranged nicely.
I also use the script in my CMS - users can add a simple piece of custom BBCode into their pages - this is the sort of thing I can see working for Wordpress, which I’ll be getting started on soon.