Hello, I'm looking for something to give me an image that is always a 'sensible' size even if the upload is very strange.

I have PHP getimagesize() for dimensions and can both scale and crop. No worries there.

However, I'm yet to come up with a set of IF statements that catches all possible images. I can scale down if the image is too big but what of a panoramic image whose height is greatly reduced with this scale? I would prefer to crop in this case.

This routine also needs to be tolerant of potrait images.

I also *always* need a thumbnail of 150x113 pixels. This will occasionally need a crop.

I do have sample code I can up but it is very faulty at present!