Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- easiest way to create a graph?
- Greg Bryant
July 26, 2004, 3:55 am
rate this thread
started in on pear::image_graph. Just wanting to start simple, I created a
new graph, set the background color, and displayed it. I also added the
header call to set the content for jpeg, but all I get is a bunch of
characters on my screen.
Here's the (excerpted) simple code:
Header ("Content-type: image/jpeg");
$defwidth = 300;
$defheight = 200;
$mychart = new Image_Graph($defwidth, $defheight);
// build the chart
I also couldn't figure out what setBackgroundColor expected, Are there any
samples about for this?
Re: easiest way to create a graph?
I get it. You need to have the <img...> tag to get an image in the first
place, and can only get the image from the gd library indirectly. I think
the design is a bit off. If I'm forced to put the img source in different
script, it makes my database access more complex than necessary, or I can
drop it in a file, which just slows down the script. Yuck. I would much
prefer to directly use the imagepng call as the img source (i.e. <img
Oh well. At least I have a nice white box now!
- » what is the correct/nice way to exit php CGI script running on aweb server?
- — Next thread in » PHP Scripting Forum