Errror in mod Image::magick or something else?
Errror in mod Image::magick or something else?
am 29.10.2005 13:53:15 von Infochannel
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()){param($_,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
''){$time=param('newpicture')}
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->{file_media_type} !~ /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
Re: Errror in mod Image::magick or something else?
am 29.10.2005 15:34:28 von Gunnar Hjalmarsson
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. ;-)
> use Image::Info qw(image_info dim);
> my $info = image_info($newfile);
> if ($info->{file_media_type} !~ /image/){
> $message.=br."Sorry your file does not appear to be an image
> file so could not be used.";
> unlink($newfile);
> }
> 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
Re: Errror in mod Image::magick or something else?
am 30.10.2005 10:14:21 von Infochannel
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
Re: Errror in mod Image::magick or something else?
am 30.10.2005 13:52:41 von Gunnar Hjalmarsson
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
Re: Errror in mod Image::magick or something else?
am 01.11.2005 17:14:39 von Infochannel
Thanks again,
I would like to check your module (whre can I get it?)
Heiner Neuling
Re: Errror in mod Image::magick or something else?
am 01.11.2005 20:20:55 von Gunnar Hjalmarsson
Infochannel wrote:
> Gunnar Hjalmarsson wrote:
>> Infochannel wrote:
>>> 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.
>
> Thanks again,
>
> I would like to check your module (whre can I get it?)
At search.cpan.org, since it's a CPAN module. Direct link:
http://search.cpan.org/perldoc?CGI%3A%3AUploadEasy
Not sure that it would help you as regards the script you bought, but
maybe your interest isn't directly related to that script.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl