print graph when debugging graph.php. (shiny, eh?)

git-svn-id: http://www.observium.org/svn/observer/trunk@2932 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-03-28 11:21:13 +00:00
parent 5b9e58ecd4
commit cdfd0d070f

View File

@@ -1,5 +1,12 @@
<?php
function data_uri($file, $mime)
{
$contents = file_get_contents($file);
$base64 = base64_encode($contents);
return ('data:' . $mime . ';base64,' . $base64);
}
$width = mres($_GET['width']);
$height = mres($_GET['height']);
$title = mres($_GET['title']);
@@ -121,6 +128,7 @@ if ($error_msg) {
$fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd);
} else {
echo(`ls -l $graphfile`);
echo('<img src="'.data_uri($graphfile,'image/png').'" alt="graph" />');
}
unlink($graphfile);
}