resize uploaded image and save to location on server.
Posted: Sun May 17, 2009 7:28 pm
Hello,
I am trying to upload an image received from a form and then save it as is and also at a smaller size.
Can anyone tell me why this is not working?
This is driving me mad, I just don't know what to do, if anyone could help me I would be extremely grateful.
Thanks
I am trying to upload an image received from a form and then save it as is and also at a smaller size.
Can anyone tell me why this is not working?
Code: Select all
This is the part of the code that processes the form:
//upload the image received in the form. this works fine, using ftp
upload($_FILES['uploadedfile']['tmp_name'], 'Images/test/large/', $_FILES['uploadedfile']['name']);
//point to uploaded file
$target_path="Images/test/".$_FILES['uploadedfile']['name'];
//make new image of correct dimensions for thumbnail
$projthumb=imagecreatetruecolor($thumbwidth, $thumbheight);
//resize the source image into the destination image
$source = imagecreatefromjpeg($target_path);
imagecopyresampled($projthumb, $source, 0,0,0,0, $thumbwidth, $thumbheight, 762, 372);
//make save jpeg to thumbnail location
imagejpeg($projthumb, 'Images/Thumbs/newimage.jpeg', 85);
imagedestroy($projthumb);Thanks