Re: Image uploading and storing issues
- Hello and thanks for the reply.
If Image::Magick is not a core perl module, which is the core and
standard perl module that everybody use to work with images? I
looking for something like PHP image manupulation functions,
something available in any web server.
And, more important: I understand that I can use upload function...
But I don't understand why Paul Dubois use:
my $image = param("image");
To retrieive the image and
$dbh->do("REPLACE INTO image (name, image, thumbnail,
mime_type), VALUES(?,?,?,?)", undef, $name, $image, $thumb,
To store it in the database without using any upload function or
similar stuff. param("image"); should be perfectly sufficient, so
perhaps I should understand in great detail how uploading works.
I only know this: after the user upload the file, the data is stored
in a temporary file on server. The script should retrieive it, but
why param("image") in this, case would not be sufficient?
--- In firstname.lastname@example.org, "Damien Carbery"
> --- In email@example.com, "kjhseka" <kjhseka@h...>wrote:
> > Hello,image
> > I have a script with several problems on it. The script is taken
> > from MySql and Perl from the Web by Paul Dubois.
> > First of all, I run it into Windows XP system, with Apache
> > server and MySql. I use IE 6 to test it. The script should
> > upload an image and store it in the database. I try the script
> > locally.
> > But...
> > 1) If I try to upload an image, actually no data is stored in the
> > database! The database is defined as follow:
> > CREATE TABLE image (name VARCHAR(60) NOT NULL, UNIQUE(name),
> > BLOB NOT NULL,the
> > thumbnail BLOB NOT NULL, mime_type VARCHAR(20) NOT NULL);
> > 2) $image variable in my $image = param("image"); should store
> > binary data of theIs
> > image, but it actually only store the path and filename! Is that
> > normal? Why the variable does not store the binary data?
> > Another thing... The Image::Magick module does no longer exist!
> > never installed inget
> > most web servers and hosting services and is very difficult to
> > it. What kind of module is used right now to process images?the
> > Here's the script, the main problem is that no data is stored in
> > database, there3.10/CGI.pm#CREATING_A_FILE_UPLOAD_FIELD
> > is surely some error, but I'm unable to locate it. Or perhaps in
> > Windows image uploading works differently?
> > #! d:/perl/bin/perl.exe
> > # upload_image.pl - upload images for e-greeting card application
> > snip the code
> > Thanks for any help.
> > Alph
> Image::Magick is not a core perl module so your hosting service may
> not have it. If they have ImageMagick installed you might be able to
> use the 'convert' executable directly. I have a script that creates
> thumbnails with 'convert'.
> According to the CGI.pm documentation
> you should use the 'upload' function to access the contents of theat
> uploaded file.
> You say you expect $image to have the image contents. From looking
> the code I would have expected $full to be used (returned by
>>>>> "kjhseka" == kjhseka <kjhseka@...> writes:kjhseka> If Image::Magick is not a core perl module, which is the core and
kjhseka> standard perl module that everybody use to work with images?
There isn't one. Most people use GD or Image::Magick or Imager.
The CPAN is your friend. Learn to use the CPAN.
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!