github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

rjray / image-size

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 2
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (17)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • gh-pages
    • master ✓
  • Tags (17)
    • v3_01
    • v3.2
    • v3_1_1
    • v3_1
    • v3_0
    • v2_991
    • v2_99
    • v2_94
    • v2_93
    • v2_92
    • r02_09_04
    • r02_09_03
    • r02_09_02
    • r2_97
    • r2_96
    • 3.220
    • 3.210
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A Perl module to read the dimensions of images in several popular formats — Read more

  cancel

http://search.cpan.org/dist/Image-Size/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Prep for 3.220. 
rjray (author)
Sun Nov 08 17:46:36 -0800 2009
commit  45c20242f137c8141c3cc76c94a7c2d61722761a
tree    3fa396afeb22940cdc32a7100894829fdac11c80
parent  85c84e5cdf9fdfd9cf878847a95d696f795e0fd7
image-size /
name age
history
message
file .gitignore Loading commit data...
file Build.PL
file ChangeLog.xml
file MANIFEST.SKIP
file README.textile
directory etc/
directory ex/
file imgsize
directory lib/
directory t/
README.textile

Image::Size – Determine the size of images in several common formats

Version: 3.220 (See CHANGES below)

WHAT IS IT

Image::Size is a library based on the image-sizing code in the wwwimagesize script, a tool that analyzes HTML files and adds HEIGHT and WIDTH tags to IMG directives. Image::Size has generalized that code to return a raw (X, Y) pair, and included wrappers to pre-format that output into either HTML or a set of attribute pairs suitable for the CGI.pm library by Lincoln Stein. Currently, Image::Size can size images in XPM, XBM, GIF, JPEG, PNG, MNG, TIFF, the PPM family of formats (PPM/PGM/PBM) and if Image::Magick is installed, the formats supported by it.

I did this because my old WWW server generated a lot of documents on demand rather than keeping them in static files. These documents not only used directional icons and buttons, but other graphics to annotate and highlight sections of the text. Without size attributes, browsers cannot render the text of a page until the image data is loaded and the size known for layout. This library enables scripts to size their images at run-time and include that as part of the generated HTML. Or for any other utility that uses and manipulates graphics. The idea of the basic interface + wrappers is to not limit the programmer to a certain data format.

USING Image::Size IN YOUR SCRIPTS

Image::Size has pod documentation that gives a more complete overview, but in a nutshell:


        use Image::Size;

        ($x, $y) = imgsize("something.gif");

And ($x, $y) is now the width and height of something.gif. 95% of my usage of this library is in conjunction with Lincoln Stein’s CGI.pm:


        use CGI ':all';
        use Image::Size 'attr_imgsize';

        #
        # Emit an IMG tag with size attributes:
        #
        print img({-SRC => '/server/images/arrow.gif',
                   attr_imgsize('/server_root/server/images/arrow.gif')});

Alternately, if you are running under Apache and mod_perl:


        # Assume $Q is an object of class CGI, $r is an Apache request object
        $r->print($Q->img({ -src => $imgpath,
                            attr_imgsize($r->lookup_uri($imgpath)->
                                         filename) }));

BUILDING/INSTALLING

This package uses Makefile.PL:


        perl Makefile.PL
        make && make test
        make install

You may need super-user access to install.

PROBLEMS/BUG REPORTS

Please send any reports of problems or bugs to rjray@blackperl.com.

CHANGES

  • lib/Image/Size.pm

Small fix to the regex for detecting GIFs, per Slaven Rezic.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server