Re: GnuPlot & Inline Images
| From: | Joe Conway | Date: | Sat, 01 Jul 2000 21:04:55 +0000 |
| Subject: | Re: GnuPlot & Inline Images | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-4298@lists.php.net to get a copy of this message | ||
>Hi *,
>
>I have this script (below) which uses gnuplot to create graphs on my
system.
>Everything is working great, but I am having to store the temporary image
on
>my hard drive, then link to it in the HTML, and go back and delete them
>daily.
>
>Is there a way to spit out this image inline, so that it is sent directly
to
>the browser, instead of stored on the hard drive first?
I do something similar with the gd library. I have one file which generates
an x-y scatterplot and sends it to the browser, graph.php3. Then I reference
graph.php3 directly from the page where I want to display it.
//*************************** start graph.php3
*************************************
// initialize the graph
init_graph ($scale);
// run query
$sql = "select x,y from foo";
$rs1 = pg_exec($conn,$sql);
for ($row1 = 0; $row1 < $numrecs; $row1++)
{
// fill array with results $rc[0]["x"] & $rc[0]["y"]
};
if ($numrecs > 0) {
drawseries ($rc,$seriesclr);
};
drawlabels ("Time","Value","$cmd");
// send the image
header("content-type: image/gif");
ImageGif($gif);
//*************************** end graph.php3
*************************************
//*************************** start mypage.php3
*************************************
$qs = "?" . $MyQueryString;
$graph = "graph.php3" . $qs;
print ("<IMG SRC=\"" . $graph . "\">\n");
//*************************** end mypage.php3
*************************************
I don't know if this will work with GnuPlot, but I have been planning to try
it sometime soon. Please let me know if you get it to work.
Hope this helps,
Joe