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
$info = getimagesize($handle->file_src_pathname); $srcWidth = $info[0]; $srcHeight = $info[1]; $widthMax = 800; $widthMax = 800; if ($srcWidth > $srcHeight) { } elseif ($srcWidth < $srcHeight) { } else { // x=y }
Needs something like this: