Generating Images with Image_Graph

From: Date: Fri, 30 Jan 2009 05:17:54 +0000
Subject: Generating Images with Image_Graph
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-29661@lists.php.net to get a copy of this message
Hello I've been trying to generate images via Image_Graph. I've wrote some code which seems to be working on when I run it as a parameter to the "php" command on linux console. So like if I type "php graph.php" graph.php being the file that contains the code that I will be displaying shortly. It creates the image and saves the PNG file to the current directory, but I get no response (no creation of the image) when I run graph.php from the web browser. I've installed PHP and apache correctly, and I can definitely run PHP code and show other outputs through the browser, but this is just crapping out a bit, could anyone share some idea on this? thanks. code: <?php require_once "Image/Graph.php"; /* set dataet variable */ $Dataset =& Image_Graph::factory('dataset'); /* Set the ranges for the x coordinate and the y coordinate */ $minDomain = $_GET["minDomain"] = 0; $maxDomain = $_GET["maxDomain"] = 20; /* Plot a parabolic graph */ for ($i = $minDomain; $i <= $maxDomain; $i++) { $ycoord = pow($i, 2); $Dataset->addPoint($i, $ycoord); } /* Initialize canvas for the graph */ $Graph =& Image_Graph::factory('graph', array(700, 400)); $Plotarea =& $Graph->addNew('plotarea'); /* Plot the data and set style attributes */ $Plot =& $Plotarea->addNew('line', array(&$Dataset)); $Plot->setLineColor('red'); /* Graph the thing */ //$Graph->done(); $Graph->done(array('filename' => './output.png')); ?>

« previous php.pear.general (#29661) next »