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 ///////////////////////////////////////////////////////////////////////////////////////////////// Link to comment https://forums.phpfreaks.com/topic/216279-help-with-thumbnail-generation-code/ 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... Link to comment https://forums.phpfreaks.com/topic/216279-help-with-thumbnail-generation-code/#findComment-1123972 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 Link to comment https://forums.phpfreaks.com/topic/216279-help-with-thumbnail-generation-code/#findComment-1123978 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. Link to comment https://forums.phpfreaks.com/topic/216279-help-with-thumbnail-generation-code/#findComment-1123980 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? Link to comment https://forums.phpfreaks.com/topic/216279-help-with-thumbnail-generation-code/#findComment-1123983 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); Link to comment https://forums.phpfreaks.com/topic/216279-help-with-thumbnail-generation-code/#findComment-1123994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.