Solved

Header from files ?

Posted on 2000-02-21
4
146 Views
Last Modified: 2010-03-05

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?
0
Comment
Question by:leoleo
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
dmag earned 50 total points
ID: 2544873
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
 

Author Comment

by:leoleo
ID: 2544919

Thanks.

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

Author Comment

by:leoleo
ID: 2544925

Thanks.

But how do I find out if a particular module is already present in our server?
0
 
LVL 84

Expert Comment

by:ozo
ID: 2545073
perldoc -l Image::Size
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question