J
Jason C
I have a web script that resizes images uploaded by the site visitor to predetermined dimensions. This works fine for JPG and PNG, but not for GIF.
I've just about copied the script verbatim from CPAN for testing, but getwidth(), etc, all return nothing:
#!/usr/bin/perl
#
use CGI::Carp qw(fatalsToBrowser);
use Imager;
use strict;
use warnings;
my $img = Imager->new();
$img->open(file=>'/home/myacct/www/myimage.gif', type=>'gif')
or die "not read";
print "Content-type: text/html\n\n";
if (-e "/home/myacct/www/myimage.gif") {
print "Image information:\n";
print " Width: ". $img->getwidth() ."\n";
print " Height: ". $img->getheight() ."\n";
print " Type: ". $img->type() ."\n";
}
else { print "not found"; }
exit;
http://search.cpan.org/~tonyc/Imager-0.85/lib/Imager/ImageTypes.pod
It prints "Image information", etc, so the image is found... it's just not being read.
I do have giflib installed on the server. I wasn't sure if I installed it before or after Imager, though, so I uninstalled Imager and reinstalled it, but that had no impact.
If any of you are familiar with Imager, is there something else that I need to do in order to get it to recognize GIF files?
I've just about copied the script verbatim from CPAN for testing, but getwidth(), etc, all return nothing:
#!/usr/bin/perl
#
use CGI::Carp qw(fatalsToBrowser);
use Imager;
use strict;
use warnings;
my $img = Imager->new();
$img->open(file=>'/home/myacct/www/myimage.gif', type=>'gif')
or die "not read";
print "Content-type: text/html\n\n";
if (-e "/home/myacct/www/myimage.gif") {
print "Image information:\n";
print " Width: ". $img->getwidth() ."\n";
print " Height: ". $img->getheight() ."\n";
print " Type: ". $img->type() ."\n";
}
else { print "not found"; }
exit;
http://search.cpan.org/~tonyc/Imager-0.85/lib/Imager/ImageTypes.pod
It prints "Image information", etc, so the image is found... it's just not being read.
I do have giflib installed on the server. I wasn't sure if I installed it before or after Imager, though, so I uninstalled Imager and reinstalled it, but that had no impact.
If any of you are familiar with Imager, is there something else that I need to do in order to get it to recognize GIF files?