File: README

package info (click to toggle)
libimage-size-perl 3.300-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 2,324 kB
  • sloc: perl: 988; xml: 987; makefile: 2
file content (134 lines) | stat: -rw-r--r-- 3,890 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Image::Size - Determine the size of images in several common formats
====================================================================

Version: 3.300 (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

  * t/all.t

  * t/old-os2.bmp (added)

Add support for old OS/2 version of BMP header (Geoff Richards).

  * lib/Image/Size.pm

Typo fixes (David Steinbrunner).

  * lib/Image/Size.pm

Avoid a sprintf() warning in Perl 5.21. Perl 5.21 introduces a warning for
redundant arguments to s?printf(), so sprintf("%d", 1, 2) would warn. This
commit silences that warning by passing sprintf the exact number of arguments
that it expects (Brian Fraser).

  * lib/Image/Size.pm

Added =encoding utf8 to pod - the accented character was causing a pod error
(Neil Bowers).

  * lib/Image/Size.pm

Added Z<> to the =item [012] to resolve pod warning. You can't have =item 0, so
the way round this seems to be to add a Z<> (zero width space) before each digit
(Neil Bowers).

  * lib/Image/Size.pm

Added link to github repo to doc (Neil Bowers).

  * lib/Image/Size.pm

RT #41238: Applied modified version of patch from user to fix a die problem with
unpack on truncated files.

  * lib/Image/Size.pm

  * t/1.sm.webp (added)

  * t/all.t

  * t/move.cur (added)

  * t/tux.ico (added)

Add support for WEBP, ICO and CUR file types (Baldur Kristinsson).

  * lib/Image/Size.pm

Fix some perlcritic issues.