Click here to get back home

Errror in mod Image::magick or something else?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Errror in mod Image::magick or something else? Infochannel 10-29-2005
Posted by Infochannel on October 29, 2005, 4:53 am
Please log in for more thread options


Hi,


I've bought a perl script a few days ago, which will not work at all.
The programmer can't or will not help me in solving the problem. Maybe
somebody here can help me a little, because I'm not experienced with
perl


the problem: The script should load an image (onto another image) which

is temporarily stored until payment is verified. The script starts as
follows:


###################################


#!/usr/bin/perl


use DBI;
use CGI qw/:standard *table start_ul/;
use Image::Magick;
use Image::Info qw(image_info dim);
use Digest::MD5 qw(md5_hex);
use LWP::UserAgent;
foreach(url_param())
require '/www/infochannel.org/thepixelwars.de/admin/payperpixel.conf';
$src = Image::Magick->new;
$back = Image::Magick->new || die "cant create object back";
$time=time();$jscript='';
if (defined param('newpicture') and param('newpicture') ne
'')
if (defined param('picture') and param('picture') ne ''){
my $file=upload('picture');
chomp $file;
$newfile="$tmpdir$time";
open (TMP,">$newfile")||die "cant write to $newfile $!";
while (<$file>){print TMP $_}
close(TMP);
my $info = image_info($newfile);
if ($info-> !~ /image/){
$message.=br."Sorry your file does not appear to be an image
file so
could not be used.";
unlink($newfile);
}
else {
param('newpicture',"$time");
}



}


##################

On my server all required modules are installed and working with other
scripts. OS is gentoo linux.


calling the script gives the error message "Sorry your file does not
appear to be an image file so could not be used."


and an empty space instead of the TMP image is shown.


Please see: http://www.thepixelwars.de/maze/index.html


I've seen, that nothing is stored in the tmpdir, so its normal that
image::info gives that error.


I really would appreciate your help in solving the problem. At the
moment I have no more ideas.


p.s. the CHMODS of the tempdir and the image were to store the nefile
in are set to 777.


thanks in advance


Heiner



Posted by Gunnar Hjalmarsson on October 29, 2005, 3:34 pm
Please log in for more thread options


Infochannel wrote:
> I've bought a perl script a few days ago, which will not work at all.
> The programmer can't or will not help me in solving the problem.

Then ask to have your money back. ;-)

<snip>

> use Image::Info qw(image_info dim);

<snip>

> my $info = image_info($newfile);
> if ($info-> !~ /image/){
> $message.=br."Sorry your file does not appear to be an image
> file so could not be used.";
> unlink($newfile);
> }

<snip>

> On my server all required modules are installed and working with other
> scripts. OS is gentoo linux.
>
> calling the script gives the error message "Sorry your file does not
> appear to be an image file so could not be used."

If the problem would lie in a CPAN module, and not in the script, it's
the Image::Info module that is used for that check, not Image::Magick.
Have you checked that the file type is supported by the version of
Image::Info you are using?

> Please see: http://www.thepixelwars.de/maze/index.html

Why? What has that page to do with it?

> I've seen, that nothing is stored in the tmpdir, so its normal that
> image::info gives that error.

Faulty conclusion, since the failed check removes the file.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


Posted by Infochannel on October 30, 2005, 1:14 am
Please log in for more thread options


Thank's,

I've solved the problem

relacing the Iine

print start_form(-id=>'myform').

by

print start_multipart_form(-id=>'myform')

btw: the script is called at the above URL by clicking the "buy blochs"
button.


thank's again
Heiner



Posted by Gunnar Hjalmarsson on October 30, 2005, 1:52 pm
Please log in for more thread options


Infochannel wrote:
> Thank's,
>
> I've solved the problem
>
> relacing the Iine
>
> print start_form(-id=>'myform').
>
> by
>
> print start_multipart_form(-id=>'myform')

Okay, that's a common (the most common?) mistake when writing file
upload apps. I wrote the CPAN module CGI::UploadEasy (not _only_ for
that reason...), which triggers a fatal error if it's feeded an
application/x-www-form-urlencoded POST request.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


Posted by Infochannel on November 1, 2005, 8:14 am
Please log in for more thread options


Thanks again,

I would like to check your module (whre can I get it?)

Heiner Neuling



Similar ThreadsPosted
image magick through apt-get November 27, 2004, 5:48 pm
Image magick palette July 30, 2004, 9:16 pm
Image::Magick newbie September 5, 2005, 10:19 pm
Image Magick code help November 29, 2004, 12:14 pm
Image Magick code help December 3, 2004, 6:43 pm
ANNOUNCE: Image::Magick::Tiler V 1.00 February 22, 2005, 11:35 am
ANNOUNCE: Image::Magick::Chart V 1.01 June 13, 2005, 3:36 am
Image::Magick scalar value to print use CGI April 13, 2006, 10:09 pm
Problems Installing Image::Magick September 26, 2006, 3:35 pm
Reduce colors with Image::Magick July 6, 2007, 7:06 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap