Sabmin Posted December 20, 2010 Share Posted December 20, 2010 so I have an array with a bunch of photos, and I'm trying to create a thumbnail of each to display on a page with a link to the full sized image but I'm getting the error in the subject title... if I just display the images in the array without trying to resize them it works fine... can anyone clue me into why this isn't working please. echo ("<a href='" . $img['file'] . "'>"); $new_width = (floor($img['size'][0] * ".25")); $new_height = (floor($img['size'][1] * ".25")); $tmp_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized($tmp_img, $img['file'], 0, 0, 0, 0, $new_width, $new_height, $img['size'][0], $img['size'][1]); echo ("<img src='" . $tmp_img . " . $img['size'][3] , "' alt=''><br>\n"); echo basename($img['file']); echo "</a><br>\n"; Quote Link to comment https://forums.phpfreaks.com/topic/222179-warning-imagecopyresized-supplied-argument-is-not-a-valid-image-resource/ Share on other sites More sharing options...
Sabmin Posted December 20, 2010 Author Share Posted December 20, 2010 alright so I got rid of the warning and later fatal error with the imagecreatefromjpeg and imagejpeg functions but now instead of a picture I get a whole lot of �����JFIF���������>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ���C� Quote Link to comment https://forums.phpfreaks.com/topic/222179-warning-imagecopyresized-supplied-argument-is-not-a-valid-image-resource/#findComment-1149412 Share on other sites More sharing options...
QuickOldCar Posted December 20, 2010 Share Posted December 20, 2010 I'm sure that can't be all the code. If using gd are supposed to send out the header of the image type, is why are seeing the garble, plus the img as basename, pretty much the code that makes the image. Try reading some gd tutorials to do what you need, or find one already made, is plenty out there very similar to what you want to accomplish. http://www.php.net/manual/en/function.imagecopyresized.php Or this script may do everything you need already http://phpthumb.sourceforge.net/ Quote Link to comment https://forums.phpfreaks.com/topic/222179-warning-imagecopyresized-supplied-argument-is-not-a-valid-image-resource/#findComment-1149442 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.