Stephen68 Posted March 29, 2009 Share Posted March 29, 2009 I have a upload script that works great, now I'm trying to resize the image that is being upload. When I add this code to the scrip it stops working, can anybody see what's wrong with out me posting the whole script. If not I can clean it up and post it <?php //Where the file is sotred on the sever $userfile_tmp = $_FILES['userfile'.$i]['tmp_name']; // Create an Image from it so we can do the resize $src = imagecreatefromjpeg($userfile_tmp); // Capture the original size of the uploaded image list($width,$height)=getimagesize($userfile_tmp); $newwidth=250; $newheight=($height/$width)*250; $tmp=imagecreatetruecolor($newwidth,$newheight); // this line actually does the image resizing, copying from the original // image into the $tmp image imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); //What the userfiles name was from the uploading user. $userfile_name = $_FILES['userfile'.$i]['name']; //Size of the file to be uploaded. $userfile_size = $_FILES['userfile'.$i]['size']; //Get the type of file that is being uploaded. $userfile_type = $_FILES['userfile'.$i]['type']; //Get error message if there are any. $userfile_error = $_FILES['userfile'.$i]['error']; //Get the type of image E.G. ed_thumb or ed $image_type = $_POST['dir'.$i]; //Directory where to put the uploaded files. $dir = $_SERVER['DOCUMENT_ROOT']."/photos/".$_POST['dir'.$i]."/"; ?> Link to comment https://forums.phpfreaks.com/topic/151631-help-with-image-resize/ Share on other sites More sharing options...
Stephen68 Posted March 29, 2009 Author Share Posted March 29, 2009 I have looked all over and can not seem to find the answer? does anybody have a better suggestion maybe? Link to comment https://forums.phpfreaks.com/topic/151631-help-with-image-resize/#findComment-796378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.