do take alook at this link below..
http://www.7tech.co.in/php/how-to-generate-a-graph-image-in-php/
I am wondering, what does this code below means?
header("Content-type:image/png");
imagepng($img);
When i try to implement this 2 lines, i will get error which said, “Cannot modify header information -headers already sent by…” And when i comment them, there is no error, but graph cannot be seen..
Hmm, does anyone know what it means, can care to explain to me? Sorry, i am very new to PHP.. Thanks in advance!
The error you’re receiving is informing you that you cannot change the response headers to
image/png, because they’ve already be set and sent. Make sure theheader()line is the very first line in your output. You cannot output anything before it.As for the second line,
imagepng(), this is used for outputting a portable-network graphic. The$imgvariable would be the image resource that would have been built earlier. The following is an extremely basic example using both of these lines: