Situation:
Ever wanted to get the size of an image?
Possibly to determine new height and width dimensions that DO NOT distort the proportion.
Well I have, and I overcame the math like so.
Solution:
First you must decide on an image width. The subroutine returns the proportional height equivalent. It uses the Image::Size module, which is available from CPAN and may be placed in a subfolder on your local server. And linked to from your script via the use lib "./yourfolder"; use Image::Size;
command.
It takes to arguments, the fixed width, and the path to the image. (relative OK)
Usage:
use strict;
use CGI;
use Image::Size; #(if installed to lib)
my $q = CGI->new();
my $height = &getImgHeight('../img/theImage.jpg', 200);
print $q->img({ -width => '200', height => $height});