The Image::Size Perl 5 Module

Jump to:
Description
System Requirements
Getting the Software
Installing
Examples
Manual Page

What is it?

Image::Size is a library I wrote, based on the wwwimagesize script by Alex Knowles. I wrote it because I was tired of my CGI scripts producing HTML pages that were delayed in loading. The delays were simply due to the lack of HEIGHT and WIDTH attributes on the image tags. I had to either start hard-coding these into the scripts, or come up with a way to determine image size at run-time.

System requirements

Obtaining Image::Size

All versions, alpha and beta releases as well as (hopefully) stable releases will be handled through CPAN, the Comprehensive Perl Archive Network. The current release version is 2.4. You may get it from:

CPAN Server at the Perl Institute: Image-Size-2.4.tar.gz
Through the CPAN Multiplexer at Perl.COM: Image-Size-2.4.tar.gz

Installing the Package

Image::Size uses Perl's own MakeMaker facility to build and install. Actual steps taken by the user should be minimal:

	zcat Image::Size-2.4.tar.gz | tar xvf -
	cd Image::Size
	perl Makefile.PL
	make
	make test
	(assuming all tests pass)
	make install   # may require super-user permissions

Examples

I use this almost exclusively in CGI scripts, along with Lincoln Stein's excellent CGI.pm library. A typical call looks somthing like this:


	print img(-SRC => 'redball.gif',
	          -ALT => 'o',
		  attr_imgsize('/full/path/to/redball.gif'));

Manual Page

The manual page is it's own page: CLICK HERE to view it.


Last modified: Thu Mar 20 18:02:28 PST 1997
randy@byz.org