I want to draw a line chart with PHP. If I make my Draw() function the only
function call, it works fine. But if I display other data, and then call my
Draw() function, I get a bunch of graphics characters, and some text. The
text says I have already defined the header info. Here is the ledgible part
of the text
Warning: Cannot modify header information - headers already sent by (output
started at /home/virtual/site8/fst/var/www/html/laps/laps.php:10) in
/home/virtual/site8/fst/var/www/html/laps/lib.php on line 498
Here is my Draw() function. I just cut and pasted some code off a website.
I can't even draw a single line yet!
<?php
function Draw()
{
Header("Content-type: image/jpeg");
$image = ImageCreate(200 ,150);
$gray = ImageColorAlloc ate($image,204, 204,204);
$blue = ImageColorAlloc ate($image,0,0, 255);
ImageLine($imag e,10,10,150,30, $blue);
ImageJPEG($imag e);
ImageDestroy($i mage);
}?>
Any ideas why I cannot call the Header function here, or why my web page
just shows a bunch of text and graphic characters ?
Thanks,
Doug
function call, it works fine. But if I display other data, and then call my
Draw() function, I get a bunch of graphics characters, and some text. The
text says I have already defined the header info. Here is the ledgible part
of the text
Warning: Cannot modify header information - headers already sent by (output
started at /home/virtual/site8/fst/var/www/html/laps/laps.php:10) in
/home/virtual/site8/fst/var/www/html/laps/lib.php on line 498
Here is my Draw() function. I just cut and pasted some code off a website.
I can't even draw a single line yet!
<?php
function Draw()
{
Header("Content-type: image/jpeg");
$image = ImageCreate(200 ,150);
$gray = ImageColorAlloc ate($image,204, 204,204);
$blue = ImageColorAlloc ate($image,0,0, 255);
ImageLine($imag e,10,10,150,30, $blue);
ImageJPEG($imag e);
ImageDestroy($i mage);
}?>
Any ideas why I cannot call the Header function here, or why my web page
just shows a bunch of text and graphic characters ?
Thanks,
Doug
Comment