Chatterton Posted October 27, 2009 Share Posted October 27, 2009 I found a cool little script for resizing images on the fly with GD at the PHP[dot]net site: http://www.php.net/manual/en/function.imagecopyresampled.php See "Example #2 Resampling an image proportionally" When I save that code as a self-contained file and modify the parameters to access an image, everything works perfectly. However, when I copy/paste the working code into another file in the exact same folder, the image renders as a bunch of garbled characters, like so: �����JFIF��������� x{V��αq�wi5��{��f���Y�$�hmഅ|�0���|_�M�GOd������d����)m��l v��J��d��#,��3*����~Q���o_â~�>��.��MSG�[�vӬ,������9��n䶋h�1e�N� ��uO� Has anyone else ever experienced this problem? If so, have you been able to fix it? I have no idea why it'd be doing this, so any help would be greatly appreciated. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/179133-solved-bizarre-gd-library-issue/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 27, 2009 Share Posted October 27, 2009 copy/paste the working code into another file Post your code in that other file showing what you are doing. You cannot output a header or image data on a web page after you output any HTML or any other characters on the page. Quote Link to comment https://forums.phpfreaks.com/topic/179133-solved-bizarre-gd-library-issue/#findComment-945116 Share on other sites More sharing options...
Chatterton Posted October 27, 2009 Author Share Posted October 27, 2009 That's likely my problem. Crud. The plan was to have several of these displaying in different spots all over the page. I guess plan B would be to upload images to the webserver that saves the images to various sizes & locations & then call them into the pages already sized using standard image tags. Does that make sense? Quote Link to comment https://forums.phpfreaks.com/topic/179133-solved-bizarre-gd-library-issue/#findComment-945128 Share on other sites More sharing options...
PFMaBiSmAd Posted October 27, 2009 Share Posted October 27, 2009 See the <img tag information in the thread at the following link - http://www.phpfreaks.com/forums/index.php/topic,274110.msg1295438.html#msg1295438 Quote Link to comment https://forums.phpfreaks.com/topic/179133-solved-bizarre-gd-library-issue/#findComment-945131 Share on other sites More sharing options...
Chatterton Posted October 27, 2009 Author Share Posted October 27, 2009 Many thanks, PFMaBiSmAd. I actually had a similar revelation as I was drifting off, so I jumped out of bed & fixed it all with passing values to the PHP image processing files with GET functions. Image tags like <img src="img.php?filename=img/books/book1&width=210&height=500" /> work perfectly now. Thanks for getting me straightened out. Quote Link to comment https://forums.phpfreaks.com/topic/179133-solved-bizarre-gd-library-issue/#findComment-945138 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.