1Image::Size - Determine the size of images in several common formats 2==================================================================== 3 4Version: 3.300 (See CHANGES below) 5 6 7WHAT IS IT 8---------- 9 10Image::Size is a library based on the image-sizing code in the wwwimagesize 11script, a tool that analyzes HTML files and adds HEIGHT and WIDTH tags to IMG 12directives. Image::Size has generalized that code to return a raw (X, Y) pair, 13and included wrappers to pre-format that output into either HTML or a set of 14attribute pairs suitable for the CGI.pm library by Lincoln Stein. Currently, 15Image::Size can size images in XPM, XBM, GIF, JPEG, PNG, MNG, TIFF, the PPM 16family of formats (PPM/PGM/PBM) and if Image::Magick is installed, the formats 17supported by it. 18 19I did this because my old WWW server generated a lot of documents on demand 20rather than keeping them in static files. These documents not only used 21directional icons and buttons, but other graphics to annotate and highlight 22sections of the text. Without size attributes, browsers cannot render the text 23of a page until the image data is loaded and the size known for layout. This 24library enables scripts to size their images at run-time and include that as 25part of the generated HTML. Or for any other utility that uses and manipulates 26graphics. The idea of the basic interface + wrappers is to not limit the 27programmer to a certain data format. 28 29 30USING Image::Size IN YOUR SCRIPTS 31--------------------------------- 32 33Image::Size has pod documentation that gives a more complete overview, but in a 34nutshell: 35 36 use Image::Size; 37 38 ($x, $y) = imgsize("something.gif"); 39 40And ($x, $y) is now the width and height of something.gif. 95% of my usage of 41this library is in conjunction with Lincoln Stein's CGI.pm: 42 43 use CGI ':all'; 44 use Image::Size 'attr_imgsize'; 45 46 # 47 # Emit an IMG tag with size attributes: 48 # 49 print img({-SRC => '/server/images/arrow.gif', 50 attr_imgsize('/server_root/server/images/arrow.gif')}); 51 52Alternately, if you are running under Apache and mod_perl: 53 54 # Assume $Q is an object of class CGI, $r is an Apache request object 55 $r->print($Q->img({ -src => $imgpath, 56 attr_imgsize($r->lookup_uri($imgpath)-> 57 filename) })); 58 59 60BUILDING/INSTALLING 61------------------- 62 63This package uses Makefile.PL: 64 65 perl Makefile.PL 66 make && make test 67 make install 68 69You may need super-user access to install. 70 71 72PROBLEMS/BUG REPORTS 73-------------------- 74 75Please send any reports of problems or bugs to rjray@blackperl.com. 76 77 78CHANGES 79------- 80 81 * lib/Image/Size.pm 82 83 * t/all.t 84 85 * t/old-os2.bmp (added) 86 87Add support for old OS/2 version of BMP header (Geoff Richards). 88 89 * lib/Image/Size.pm 90 91Typo fixes (David Steinbrunner). 92 93 * lib/Image/Size.pm 94 95Avoid a sprintf() warning in Perl 5.21. Perl 5.21 introduces a warning for 96redundant arguments to s?printf(), so sprintf("%d", 1, 2) would warn. This 97commit silences that warning by passing sprintf the exact number of arguments 98that it expects (Brian Fraser). 99 100 * lib/Image/Size.pm 101 102Added =encoding utf8 to pod - the accented character was causing a pod error 103(Neil Bowers). 104 105 * lib/Image/Size.pm 106 107Added Z<> to the =item [012] to resolve pod warning. You can't have =item 0, so 108the way round this seems to be to add a Z<> (zero width space) before each digit 109(Neil Bowers). 110 111 * lib/Image/Size.pm 112 113Added link to github repo to doc (Neil Bowers). 114 115 * lib/Image/Size.pm 116 117RT #41238: Applied modified version of patch from user to fix a die problem with 118unpack on truncated files. 119 120 * lib/Image/Size.pm 121 122 * t/1.sm.webp (added) 123 124 * t/all.t 125 126 * t/move.cur (added) 127 128 * t/tux.ico (added) 129 130Add support for WEBP, ICO and CUR file types (Baldur Kristinsson). 131 132 * lib/Image/Size.pm 133 134Fix some perlcritic issues. 135