sseeley Posted August 16, 2009 Share Posted August 16, 2009 I am using the following code to upload a photo which is working really well. <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 100020000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> What I would like to do is reduce the size of Height and Width of the image. I have search google for some help but none as yet, can anyone me with some code to do this? Many thanks in advance. Stuart Quote Link to comment https://forums.phpfreaks.com/topic/170528-photograph-upload/ Share on other sites More sharing options...
sKunKbad Posted August 16, 2009 Share Posted August 16, 2009 The examples in the docs should help you: http://us.php.net/manual/en/function.imagecreatefromjpeg.php Quote Link to comment https://forums.phpfreaks.com/topic/170528-photograph-upload/#findComment-899530 Share on other sites More sharing options...
tommyda Posted August 16, 2009 Share Posted August 16, 2009 Just google "PHP image upload resize" Quote Link to comment https://forums.phpfreaks.com/topic/170528-photograph-upload/#findComment-899579 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.