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.
more info about the class
if($handle->image_x > 800) { $handle->image_resize = true; $handle->image_ratio = true; $handle->image_x = 800; //width }
How to get the width of the image being sent and whether it is greater than XX pixels, reduce.
This example s not function: