Nov 22, 2004, 1:38 AM
Post #1 of 4
Code is driving me insane!!!!
If any one could help we here it would be excellent!!!!!!!! This thing is driving me crazy!!!!!!!! Im using a flat file database that contains the filenames of various images that I want to resize using Image::Magick. The database looks like this
1|photo of dog|dog.jpg
2|photo of guitar|guitar.jpg
3|photo of car|car.jpg
My code is below. To me (and KevinR) looks fine but it doesnt work. I cant for the life of me figure it out. But i keep getting 500 errors.
If anyone could help me and would be very very very very very much appreciated. :)
The error message that my web server got when they ran the code and the code itself is below. (Below I have substituted www.mydomain.com.au for my actual website address, so thats not the error :p)
Thanking you in advance,
This is the error that my web server guys got when they ran the code below.
<?xml version="1.0" encoding="iso-8859-1"?>
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"
[Mon Nov 22 17:27:48 2004] im.cgi: Exception 410: no images to mogrify
(Resize) at /webhome/www.mydomain.com.au/cgi-bin/shoppingcart/im.cgi
line 25, <INPUT> line 1.
Here is da code.
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
print start_html("Image Magick");
my ($dir, $filename) = @_;
open INPUT, $filename or die "Couldn't open $filename";
my @data = split "|";
my $imgfile = $data;
my $img = new Image::Magick(size=>"50x50");
if ($img->Read($dir . $imgfile))
$imgfile =~ s/.jpg$/.50x50.jpg/;
$img->Write($dir . $imgfile);
push @out, $imgfile;