
inlimbo
User
Nov 22, 2004, 1:38 AM
Post #1 of 4
(708 views)
|
Code is driving me insane!!!!
|
Can't Post
|
|
Hi, 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 #number|decription|filename 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, inlimbo This is the error that my web server guys got when they ran the code below.
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"><head><title>Image Magick</title> [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.
#!/usr/bin/perl -wT use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use Image::Magick; print header; print start_html("Image Magick"); &ProcessImages("http://www.mydomain.com.au/shoppingcart/", "database.txt"); sub ProcessImages { my ($dir, $filename) = @_; my @out; open INPUT, $filename or die "Couldn't open $filename"; while (<INPUT>) { chomp; my @data = split "|"; my $imgfile = $data[2]; my $img = new Image::Magick(size=>"50x50"); if ($img->Read($dir . $imgfile)) { $img->Resize(geometry=>"50x50"); $imgfile =~ s/.jpg$/.50x50.jpg/; $img->Write($dir . $imgfile); push @out, $imgfile; } } close INPUT; return @out; }
|