Folks,
I understand that this is a browser question. However, maybe some perl experts may have the answer to it, that why my apologies upfront:-)
I have a cgi form that takes some user input and plots a perl GD graph. I have the sequence as shown in the code with some actual code. When I use "save Image as" link on the Mozilla firefox, it saves the HTML for form instead of png code.
Sorry, I can have parts of the program in the code, since it gets too long. Do I have to open a png file and save the file for the browser to see the png code?
Please help.
Regards,
Rakhee
#!/usr/bin/perl -w
#
#
# This is the HTML form for selecting projects for QA Metrics
#
use lib qw(/tools/local/lib/perl5);
use strict;
use warnings;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use DBI;
use GD::Graph::linespoints;
use Date::Calc qw(check_date Add_Delta_Days);
my $cgi = new CGI;
if ( !$cgi->param ) {
### The form goes here
} else {
if(no_errors) {
##### Run DBI query - get data
#####Plot perl GD graph
my $title = "Open Bugs for $project_name1";
my $mygraph = GD::Graph::linespoints->new( 600, 400 );
#my @legend_keys = qw(new_bugs open_bugs reopen_bugs fixed_bugs verifi
+ed_bugs );
$mygraph->set(
x_label => 'Log_Date',
y_label => $y_label,
x_label_skip => 10,
x_labels_vertical => 'true',
title => $title,
legend_placement => 'BL',
legend_marker_height => 12,
dclrs => [qw(green blue red yellow brown or
+ange)],
) or warn $mygraph->error;
$mygraph->set_legend(@legend_keys);
$mygraph->set_title_font(GD::gdGiantFont);
$mygraph->set_x_label_font(GD::gdLargeFont);
$mygraph->set_y_label_font(GD::gdLargeFont);
my $myimage = $mygraph->plot( \@data ) or die $mygraph->error;
# binmode STDOUT;
print $cgi->header( -type => 'image/png' );
print $myimage->png;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.