зеркало из https://github.com/mozilla/pjs.git
patch from bug 2178 applied and fix for versions of GD/Chart::Lines that won't
produce gifs.
This commit is contained in:
Родитель
7cb21a33be
Коммит
f457500ebc
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
use diagnostics;
|
use diagnostics;
|
||||||
use strict;
|
use strict;
|
||||||
|
use GD;
|
||||||
eval "use Chart::Lines";
|
eval "use Chart::Lines";
|
||||||
|
|
||||||
require "CGI.pl";
|
require "CGI.pl";
|
||||||
|
@ -438,8 +439,14 @@ FIN
|
||||||
|
|
||||||
$prodname =~ s/\//-/gs;
|
$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 $file = join '/', $dir, $prodname;
|
||||||
my $image = "$file.gif";
|
my $image = "$file.$type";
|
||||||
|
my $url_image = $dir . "/" . url_quote($prodname) . ".$type";
|
||||||
|
|
||||||
if (! open FILE, $file)
|
if (! open FILE, $file)
|
||||||
{
|
{
|
||||||
|
@ -495,11 +502,11 @@ FIN
|
||||||
$img->set (%settings);
|
$img->set (%settings);
|
||||||
|
|
||||||
open IMAGE, ">$image" or die "$image: $!";
|
open IMAGE, ">$image" or die "$image: $!";
|
||||||
$img->gif (*IMAGE, \@data);
|
$img->$type (*IMAGE, \@data);
|
||||||
close IMAGE;
|
close IMAGE;
|
||||||
|
|
||||||
print <<FIN;
|
print <<FIN;
|
||||||
<img src="$image">
|
<img src="$url_image">
|
||||||
<br clear=left>
|
<br clear=left>
|
||||||
<br>
|
<br>
|
||||||
FIN
|
FIN
|
||||||
|
|
Загрузка…
Ссылка в новой задаче