fraser5002 Posted October 19, 2010 Share Posted October 19, 2010 Hi i am using a script to upload an image and resize it twice first to create the large image and then again to create a thumbnail. The large image is being created fine and is uploading ok. I'm using the following code to then make the thumbnail but it does not appear to be working ( well nothing is in the thumbnail image folder i expect it to be anyways) can anyone see anything obvious that i am doing wrong ? Many Thanks /////////////////////////// Create a Thumbnail of the Image //////////////////////////////////// list($width, $height) = getimagesize($upload_image); // this is the large image which has apready been uploaded $ratio = $height/$width; if($ratio >= '1') // portret { $ht_tmb = 150; $br_tmb = 150/$ratio; } else { // landscape $ht_tmb = 150*$ratio; $br_tmb = 150; } // create thumb $source = imagecreatefromjpeg($upload_image); // The large image already uploaded //--- resize uploaded file $resize = imagecreatetruecolor($br_tmb, $ht_tmb); imagecopyresized($resize, $source, 0, 0, 0, 0, $br_tmb, $ht_tmb, $width, $height); imagejpeg($resize, "gallery_images/small/" .$filenamefd); $image = imagecreatefromjpeg("gallery_images/small/" .$filenamefd); imagejpeg($image, "gallery_images/small/" . $filenamefd); // end of making thumb ///////////////////////////////////////////////////////////////////////////////////////////////// Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted October 19, 2010 Share Posted October 19, 2010 first guess is improper permissions on the /gallery_images/small directory... Quote Link to comment Share on other sites More sharing options...
fraser5002 Posted October 19, 2010 Author Share Posted October 19, 2010 Yeh that was my first thought too but it is definetley CHMOD 777 Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted October 19, 2010 Share Posted October 19, 2010 i suggest that you change the path to a full, absolute path. $_SERVER['DOCUMENT_ROOT'] . "/gallery_images/small/", also echo out the full path with file name to check to make sure it's not empty. Quote Link to comment Share on other sites More sharing options...
fraser5002 Posted October 19, 2010 Author Share Posted October 19, 2010 Im not sure how to debug it as the upload script is seperate and i just call it from my main page, so i'm not sure how to use echo? Quote Link to comment Share on other sites More sharing options...
schilly Posted October 19, 2010 Share Posted October 19, 2010 is $filenamefd set? could also try turning all errors on error_reporting(E_ALL); Quote Link to comment 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.