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); if ($info[0]>600) { // resize } else { // dont resize }
Check out php.net for more info on getimagesize()