class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
Yeah, it would be great to be able to get image x and image y prior to processing it, sometimes scaling images to fit into let's say a 600x600 box is not good enough since smaller images will get scaled and will loss quality.Reply
For the doc: "Set this variable to keep the original size ratio to fit within image_x x image_y, but only if original image is bigger."