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! 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); 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 Link to comment https://forums.phpfreaks.com/topic/262342-thumbnail-generating/#findComment-1344457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.