our $Begin = param ('begin');
our $End = param ('end');
our $GraphWidth = param ('width');
+our $OutputFormat = 'PNG';
+our $ContentType = 'image/png';
+
+if (param ('format'))
+{
+ my $temp = param ('format') || '';
+ $temp = uc ($temp);
+
+ if ($temp =~ m/^(PNG|SVG|EPS|PDF)$/)
+ {
+ $OutputFormat = $temp;
+
+ if ($OutputFormat eq 'SVG') { $ContentType = 'image/svg+xml'; }
+ elsif ($OutputFormat eq 'EPS') { $ContentType = 'image/eps'; }
+ elsif ($OutputFormat eq 'PDF') { $ContentType = 'application/pdf'; }
+ }
+}
if ($Debug)
{
addr => gc_get_scalar ('UnixSockAddr', undef),
interval => gc_get_scalar ('Interval', 10));
-print STDOUT header (-Content_type => 'image/png',
+print STDOUT header (-Content_type => $ContentType,
-Last_Modified => epoch_to_rfc1123 ($obj->getLastModified ()),
-Expires => epoch_to_rfc1123 ($expires));
}
$| = 1;
- RRDs::graph ('-', '-a', 'PNG', '--width', $GraphWidth, @timesel, @$args);
+ RRDs::graph ('-', '-a', $OutputFormat, '--width', $GraphWidth, @timesel, @$args);
if (my $err = RRDs::error ())
{
print STDERR "RRDs::graph failed: $err\n";