PHP and Graphs
Currently I am checking the Graphite open source (under GLPL license).
If found the installation guide lack in info.
Anyway this is what I did:
1) Download the zip file from http://graphpite.sourceforge.net/
2) Unzip it to xampp/htdocs
3) In order to see the examples, I
a) Copied the src folder under the examples folder and renamed it to Image
b) Added the next test code:
Saving image
//require_once(”linechart1.php”);
$result = download(’http://localhost:70/graphpite/examples/linechart1.php’, ‘./test.png’);
function download($file_source, $file_target) {
$rh = fopen($file_source, ‘rb’);
$wh = fopen($file_target, ‘wb’);
if ($rh===false || $wh===false) {
// error reading or opening file
return false;
}
while (!feof($rh)) {
if (fwrite($wh, fread($rh, 1024)) === FALSE) {
// ‘Download error: Cannot write to file (’.$file_target.’)';
return false;
}
}
fclose($rh);
fclose($wh);
echo (”Cache “.$file_target.” created successfully”);
// No error
return true;
}
4) I also verified that the PHP_GD 2 was enabled, and copied the GD dll to system 32. See link.
?>
Comments