Header from files ?


Can I get size info of a file (GIF, JPG etc.) from its header ?

After I upload a file using the "file" input type, I require the width and height of the uploaded image in my Perl program.
How can I get it?
leoleoAsked:
Who is Participating?
 
dmagConnect With a Mentor Commented:
You want to use the Image::Size module. It knows 7 different file formats. Usage is simple:

use CGI ':all';
use Image::Size 'attr_imgsize';
print img({-SRC => '/server/images/arrow.gif',
  attr_imgsize('/server_root/server/images/arrow.gif')});


Get it from: http://www.cpan.org/authors/id/RJRAY/
0
 
leoleoAuthor Commented:

Thanks.

But how do I find out if a particular module is already present in our server?
0
 
leoleoAuthor Commented:

Thanks.

But how do I find out if a particular module is already present in our server?
0
 
ozoCommented:
perldoc -l Image::Size
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.