here is what I use to keep it under 800x600
$orig_image = imagecreatefromjpeg($file['tmp_name']);
list($width,$height) = getimagesize($file['tmp_name']);
if(max($width,$height) > 800){
$scale = 800/max($width,$height);
$new_width = floor($width*$scale);
$new_height = floor($height*$scale);
$save_image = imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($save_image,$orig_image,0,0,0,0,$new_width,$new_height,$width,$height);
imagejpeg($save_image,self::$FILE_DIRECTORY."$year_month/$fileId.jpg");
$orig_image = $save_image;
$width = $new_width;
$height = $new_height;
}
hopefully you can extrapolate a solution off that.. also not that my $file variable is coming from an uploaded file in the $_FILE array.