Page 1 of 1

header + thumbnail class

Posted: Sat Apr 21, 2007 1:14 am
by tarja311
Hi All.

I am using the Thumbnail Generator Class from http://www.phpgd.com/scripts.php?script=1 This class works great for my needs, unfortunately, implementing it is not a walk in the park.

About my site :
My site is already is full of content and images (mostly thumbnails) that are resized by html (width = ). I have an index page that is the outside frame (hyperlinks, search bar) and a "main" that is in the middle of the outside frame and displays the thumbnails.

Problem :
When i invoke the thumbnail class ... i receive the good ol' "Warning: Cannot modify header information - headers already sent by" warning message, and i guess that's because

Code: Select all

header("Content-type: image/jpeg;");
is being called after stuff has already been sent to the browser. Is there a way to make it so i don't have to send a header? I've noticed that most or all classes that manipulate images have to send a header to the browser so it knows what type of data it is. Or is there a way i can call this header before the data is sent and not mess up my site. If so then where?

Thanks

-- tarja

Posted: Sat Apr 21, 2007 3:50 am
by onion2k
I'm guessing here, but I imagine you're trying to resize the image and send the output along with your HTML. That doesn't work*. You need to create a seperate script for your images and call it using the HTML image tag.

For example:

Code: Select all

<img src="/resize.php?image=myimage.jpg">
resize.php would be a script that just resizes your image and outputs it ... no HTML or anything.

* Ok, it does work in IE, but it's still wrong.