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
See all posts See thread Reply
$foo->allowed = array('image/*'); $foo->image_convert = 'jpg';
$foo->image_max_width = 640; $foo->file_max_size = 300 * 1024;
$foo->image_resize = true; $foo->image_ratio_no_zoom_in = true; $foo->image_x = 640; $foo->jpeg_size = 300 * 1024;
You will put three fields in the form. In that case, you will have to tramsform a bit your $_FILES variable. See the faq for multiple uploads.
As for the class, here are the settings that should satisfy your requirements:
Then, to forbid images larger than 640px wide, add:
But you can also simply resize all images larger than 640px, so add instead:
Hope this helps. The rest will be for you to figure out, it is beyond the scope of the class.