Jump to content

[SOLVED] Bizarre GD Library Issue


Chatterton

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/179133-solved-bizarre-gd-library-issue/
Share on other sites

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.

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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.