About Image_Graph error
| From: | Ji Park | Date: | Mon, 26 Jan 2009 00:33:18 +0000 |
| Subject: | About Image_Graph error | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-29646@lists.php.net to get a copy of this message | ||
Hello I am currently trying to generate a graph to display on a webpage by
using PHP and PEAR (image_graph). I ran in to a proble saying that I have no
permission on saving the output png file to the directory, I was wondering
if anyone can shine some light on it.
The error:
*Warning*: imagepng()
[function.imagepng<http://127.0.0.1/cmp/function.imagepng>]:
Unable to open './output.png' for writing: Permission denied in *
/usr/share/php/Image/Canvas/GD/PNG.php* on line *119*
My 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"];
$maxDomain = $_GET["maxDomain"];
/* 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'));
?>