]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
patch from bug 2178 applied and fix for versions of GD/Chart::Lines that won't
authordonm%bluemartini.com <>
Wed, 26 Apr 2000 04:05:32 +0000 (04:05 +0000)
committerdonm%bluemartini.com <>
Wed, 26 Apr 2000 04:05:32 +0000 (04:05 +0000)
produce gifs.

reports.cgi

index 6b2d8cb1bccc44a2096ac7a674db3c4994180923..be21d0d6c3192ad4f36eb8aef7c6854a63afeea2 100755 (executable)
@@ -28,6 +28,7 @@
 
 use diagnostics;
 use strict;
+use GD;
 eval "use Chart::Lines";
 
 require "CGI.pl";
@@ -438,8 +439,14 @@ FIN
 
         $prodname =~ s/\//-/gs;
 
+       my $testimg = Chart::Lines->new(2,2);
+       my $x = '$testimg->gif()';
+       eval $x;
+       my $type = ($@ =~ /Can't locate object method/) ? "png" : "gif";
+
         my $file = join '/', $dir, $prodname;
-       my $image = "$file.gif";
+       my $image = "$file.$type";
+       my $url_image = $dir . "/" . url_quote($prodname) . ".$type";
 
        if (! open FILE, $file)
                {
@@ -495,11 +502,11 @@ FIN
        $img->set (%settings);
        
        open IMAGE, ">$image" or die "$image: $!";
-       $img->gif (*IMAGE, \@data);
+       $img->$type (*IMAGE, \@data);
        close IMAGE;
 
        print <<FIN;
-<img src="$image">
+<img src="$url_image">
 <br clear=left>
 <br>
 FIN