Gossamer Forum
Home : Products : DBMan : Customization :

Validation again (sorry)

Quote Reply
Validation again (sorry)
I tried to find this in the forum... Is there any Perl code that checks the actual width and height of an image? That can check a specific image and returns those values to use in the code.

Also, did anyone figure out a good way of adding validation to images that are being uploaded? I would only like images to need validation, i e not the whole records.

Many thanks!
Quote Reply
Re: [eric74] Validation again (sorry) In reply to
To get an image size you may want to use the perl module Image::Size. It's the most efficient method I know of.
Quote Reply
Re: [RedRum] Validation again (sorry) In reply to
http://www.perldoc.com/cpan/Image/Size.html
Quote Reply
Re: [RedRum] Validation again (sorry) In reply to
from your site?
Quote Reply
Re: [eric74] Validation again (sorry) In reply to
At thr url above.
Quote Reply
Re: [RedRum] Validation again (sorry) In reply to
Excellent. I have installed the script as described. Not sure what file it is I should use though, in the "use xxx". It says "use Image::Size;" but I cant find that file, should it be "imgsize"? Thanks!
Quote Reply
Re: [eric74] Validation again (sorry) In reply to
use Image::Size;

......should work if your host has it installed.
Quote Reply
Re: [RedRum] Validation again (sorry) In reply to
Yeah should be installed. Im using:

use Image::Size;
($x, $y) = imgsize("path..");

... but $x/y doesnt receive a value.. I guess I've totally missunderstood something here.
Quote Reply
Re: [eric74] Validation again (sorry) In reply to
Try:

use Image::Size;

$size = html_imgsize("/path/to/bla.gif");
Quote Reply
Re: [RedRum] Validation again (sorry) In reply to
hmm.. then I get "Undefined subroutine html_imgsize" (I never got an error using the solution above though...
Quote Reply
Re: [eric74] Validation again (sorry) In reply to
Seems to work ok on my Win98 server.

I used.....

#!/perl/bin/perl

use Image::Size;

print "Content-type: text/html\n\n";

print imgsize("/images/dbtitle.gif");

.......and it printed......

30533GIF

(305x33)


Last edited by:

RedRum: Oct 3, 2001, 11:11 AM