Solved

Header from files ?

Posted on 2000-02-21
4
147 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to extract data from a table into a fixed length file 10 61
transpose into pipe delemited 8 81
Port 80 requests 16 103
unable to remove invisible characters with perl 2 96
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…

726 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