rpsep2 Posted May 10, 2012 Share Posted May 10, 2012 hi guys, im trying to resize and save a thumbnail version of images uploaded to my site in a sub folder (thumbs). I've currently got: $image=imagecreatefromjpeg($filepath); list($width, $height) = getimagesize($filepath); $new_width = 200; $new_height= 150; $image_p=imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Save the image imagejpeg($image_p, '/thumbs'.$filepath); // Free up memory imagedestroy($image_p); but it appears to do nothing, but it also doesn't return any errors? could someone help me out please? thanks! Quote Link to comment https://forums.phpfreaks.com/topic/262342-thumbnail-generating/ Share on other sites More sharing options...
Barand Posted May 10, 2012 Share Posted May 10, 2012 Except for filepath changes (to suite my folders) I ran your code - no problems ??? <?php $filepath = "./images/mainframe.jpg" ; $image=imagecreatefromjpeg($filepath); list($width, $height) = getimagesize($filepath); $new_width = 200; $new_height= 150; $image_p=imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Save the image imagejpeg($image_p, './images/thumb.jpg'); // Free up memory imagedestroy($image_p); Quote Link to comment https://forums.phpfreaks.com/topic/262342-thumbnail-generating/#findComment-1344437 Share on other sites More sharing options...
rpsep2 Posted May 10, 2012 Author Share Posted May 10, 2012 its the filepaths that were wrong, i had /thumbsFILEPATH when it obviously needed to be thumbs/FILEPATH Quote Link to comment https://forums.phpfreaks.com/topic/262342-thumbnail-generating/#findComment-1344457 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.