You do this wrong, because rrd_graph()
returns array
not image. You should change this to look it i.e. like this:
$fileName = "rrd.png";
rrd_graph($fileName, $options);
header("Content-Type: image/png");
header("Content-Length: " . filesize($name));
$fp = fopen($name, 'rb');
if( $fp ) {
fpassthru($fp);
fclose($fp);
}
exit();
Please always read the docs first: http://php.net/manual/en/function.rrd-graph.php
PS: Unless you know you need it, never use ?>
- it saves you from accidentally outputing something back to i.e. browser (like whitespaces or LF
s after the ?>
)