Skip to content

Commit

Permalink
Provide meaningful filenames for graphs
Browse files Browse the repository at this point in the history
Gives decent default name when saving graph from browser as file and distinguishable tab for tabs showing graph.php output.
  • Loading branch information
Self-Perfection authored Jun 19, 2018
1 parent f0d84d0 commit e9a1fed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions type/Base.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,13 @@ function rrd_graph($debug = false) {
if (is_numeric($this->cache) && $this->cache > 0)
header("Expires: " . date(DATE_RFC822,strtotime($this->cache." seconds")));

if ($style === 'svg')
if ($style === 'svg') {
header("content-type: image/svg+xml");
else
header('Content-Disposition: filename="' . $this->rrd_title . '.svg"');
} else {
header("content-type: image/png");
header('Content-Disposition: filename="' . $this->rrd_title . '.png"');
}

$shellcmd = array_merge(
$this->rrd_graph_command($style),
Expand Down

0 comments on commit e9a1fed

Please sign in to comment.