in reply to displaying an image

How about caching each resized image as a file whose name or path encodes the size? That way the expensive stuff only needs to be done once.

After Compline,
Zaxo