[ILUG-BOM] Image Support with PHP

Philip S Tellis philip@[EMAIL-PROTECTED]
Wed Sep 4 10:49:46 IST 2002


On Tue, 3 Sep 2002 kapil_karekar at vsnl.net wrote:

Please fix your line length.

> When I include the PHP file(ex. graph.php), which generates the PNG
> image, in my current html file, it gives an error saying "Headers
> already sent". It then displays the image as ASCII text. This happens
> only when the include statement is preceeded by any html tags.

Umm, you can't send your html and image as part of the same data stream.  
They have to be two separate data streams, in response to two separate 
HTTP requests.

ie, user requests page, you send:

Content-type: text/html

<html>....

<img src="script.php?send-image">


user requests script.php?send-image, you send:

Content-type: image/png

image data here

You're trying to send both in a single HTTP response.

-- 
They said the same thing about Urkle; that little snot.  Boy I'd like
to smack that kid.

		-- Homer Simpson
		   Bart Gets Famous





More information about the Linuxers mailing list