stublackett Posted January 27, 2009 Share Posted January 27, 2009 Hi, I've got an Image Resize Script in place, It seems to work. The images get uploaded to the site, The string goes in the Database without a problem. The issue I have is that any image that is SMALLER than the image that is being uploaded just produces a Black Box ??? ??? An example of this is at : http://www.doughtys.co.uk/public/propertydetails.php?pRef=35 All Four Images were smaller than the constrain sizes. So just turned out black, But other pictures have worked without issue. Any ideas on how to solve this!? My code is : <?php // Image Upload / Resize //IMAGE 1 / // This is the temporary file created by PHP $uploadedfile = $_FILES['pImage1']['tmp_name']; //Image 1 being the "Name" from the Form Field // Create an Image from it so we can do the resize $src = imagecreatefromjpeg($uploadedfile); // Capture the original size of the uploaded image list($width,$height)=getimagesize($uploadedfile); $newwidth=345; $newheight=235; $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); //Set the DIR to Upload To $filename = $uploaddir. $_FILES['pImage1']['name']; //Image 1 being the "Name" from the Form Field imagejpeg($tmp,$filename,100); imagedestroy($src); imagedestroy($tmp); // NOTE: PHP will clean up the temp file it created when the request // has completed. ?> Cheers guys! Link to comment https://forums.phpfreaks.com/topic/142617-image-resize-help/ Share on other sites More sharing options...
stublackett Posted January 27, 2009 Author Share Posted January 27, 2009 I'm not even too bothered if the Re-Size is taken out to tell you the truth. It seems the customer is uploading images of any size anyway. There not going to be too big, So if someone has a suggestion on how I just upload the image on its own WITHOUT a resize that would also be welcome!! Link to comment https://forums.phpfreaks.com/topic/142617-image-resize-help/#findComment-747498 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.