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
$handle = new Upload("temp/" . $savedname); $handle->image_resize = true; $handle->image_ratio_crop = true; $handle->image_y = $image_size_small; $handle->image_x = $image_size_small; $handle->image_convert = 'jpg'; $handle->jpeg_quality = 80; $handle->Process("small/");