I want to take an image and resize it to 500 by 500 max IF it exceeds that in dimensions and then upload it, how can this be done? What I have: foreach ($_FILES["pictures"]["error"] as $key => $error) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, $name); }
Myself I'ld solve this with PHP's GD library. However, not everyone has GD installed at his/her server. Before, please check if you have GD installed at your server, and let me know (open phpinfo(), and find "GD". See if status is installed)
You cannot test the size of the image before uploading it. This cannot be done within a browser, but only with a server-side script (like PHP) which requires the full file to test it.
It is a fact that you can't test the image size before uploading it, but afterwards the GD -if necessary- simple resizes the image