1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.3
4 .\" ========================================================================
5 .de Sh \" Subsection heading
13 .de Sp \" Vertical space (when we can't use .PP)
17 .de Vb \" Begin verbatim text
22 .de Ve \" End verbatim text
26 .\" Set up some character translations and predefined strings. \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote. | will give a
29 .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
37 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD. Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
57 . tm Index:\\$1\t\\n%\t"\\$2"
63 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear. Run. Save yourself. No user-serviceable parts.
70 . \" fudge factors for nroff and troff
79 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
85 . \" simple accents for nroff and troff
95 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
102 . \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 . \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 . \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
129 .\" ========================================================================
131 .IX Title "Template::Plugin::Image 3"
132 .TH Template::Plugin::Image 3 "2008-11-13" "perl v5.8.7" "User Contributed Perl Documentation"
134 Template::Plugin::Image \- Plugin access to image sizes
136 .IX Header "SYNOPSIS"
138 \& [% USE Image(filename) %]
140 \& [% Image.height %]
141 \& [% Image.size.join(', ') %]
146 .IX Header "DESCRIPTION"
147 This plugin provides an interface to the Image::Info or Image::Size
148 modules for determining the size of image files.
150 You can specify the plugin name as either '\f(CW\*(C`Image\*(C'\fR' or '\f(CW\*(C`image\*(C'\fR'. The
151 plugin object created will then have the same name. The file name of
152 the image should be specified as a positional or named argument.
155 \& [% # all these are valid, take your pick %]
156 \& [% USE Image('foo.gif') %]
157 \& [% USE image('bar.gif') %]
158 \& [% USE Image 'ping.gif' %]
159 \& [% USE image(name='baz.gif') %]
160 \& [% USE Image name='pong.gif' %]
163 A \f(CW\*(C`root\*(C'\fR parameter can be used to specify the location of the image file:
166 \& [% USE Image(root='/path/to/root', name='images/home.png') %]
167 \& # image path: /path/to/root/images/home.png
168 \& # img src: images/home.png
171 In cases where the image path and image url do not match up, specify the
175 \& [% USE Image(file='/path/to/home.png', name='/images/home.png') %]
178 The \f(CW\*(C`alt\*(C'\fR parameter can be used to specify an alternate name for the
179 image, for use in constructing an \s-1XHTML\s0 element (see the \f(CW\*(C`tag()\*(C'\fR method
183 \& [% USE Image('home.png', alt="Home") %]
186 You can also provide an alternate name for an \f(CW\*(C`Image\*(C'\fR plugin object.
189 \& [% USE img1 = image 'foo.gif' %]
190 \& [% USE img2 = image 'bar.gif' %]
193 The \f(CW\*(C`name\*(C'\fR method returns the image file name.
196 \& [% img1.name %] # foo.gif
199 The \f(CW\*(C`width\*(C'\fR and \f(CW\*(C`height\*(C'\fR methods return the width and height of the
200 image, respectively. The \f(CW\*(C`size\*(C'\fR method returns a reference to a 2
201 element list containing the width and height.
204 \& [% USE image 'foo.gif' %]
205 \& width: [% image.width %]
206 \& height: [% image.height %]
207 \& size: [% image.size.join(', ') %]
210 The \f(CW\*(C`modtime\*(C'\fR method returns the modification time of the file in question,
211 suitable for use with the Date plugin, for example:
214 \& [% USE image 'foo.gif' %]
216 \& [% date.format(image.modtime, "%B, %e %Y") %]
219 The \f(CW\*(C`attr\*(C'\fR method returns the height and width as \s-1HTML/XML\s0 attributes.
222 \& [% USE image 'foo.gif' %]
229 \& width="60" height="20"
232 The \f(CW\*(C`tag\*(C'\fR method returns a complete \s-1XHTML\s0 tag referencing the image.
235 \& [% USE image 'foo.gif' %]
242 \& <img src="foo.gif" width="60" height="20" alt="" />
245 You can provide any additional attributes that should be added to the
249 \& [% USE image 'foo.gif' %]
250 \& [% image.tag(class="logo" alt="Logo") %]
256 \& <img src="foo.gif" width="60" height="20" alt="Logo" class="logo" />
259 Note that the \f(CW\*(C`alt\*(C'\fR attribute is mandatory in a strict \s-1XHTML\s0 \f(CW\*(C`img\*(C'\fR
260 element (even if it's empty) so it is always added even if you don't
261 explicitly provide a value for it. You can do so as an argument to
262 the \f(CW\*(C`tag\*(C'\fR method, as shown in the previous example, or as an argument
265 \& [% USE image('foo.gif', alt='Logo') %]
267 .SH "CATCHING ERRORS"
268 .IX Header "CATCHING ERRORS"
269 If the image file cannot be found then the above methods will throw an
270 \&\f(CW\*(C`Image\*(C'\fR error. You can enclose calls to these methods in a
271 \&\f(CW\*(C`TRY...CATCH\*(C'\fR block to catch any potential errors.
277 \& error; # print error
281 .SH "USING Image::Info"
282 .IX Header "USING Image::Info"
283 At run time, the plugin tries to load Image::Info in preference to
284 Image::Size. If Image::Info is found, then some additional methods are
285 available, in addition to \f(CW\*(C`size\*(C'\fR, \f(CW\*(C`width\*(C'\fR, \f(CW\*(C`height\*(C'\fR, \f(CW\*(C`attr\*(C'\fR, and \f(CW\*(C`tag\*(C'\fR.
286 These additional methods are named after the elements that Image::Info
287 retrieves from the image itself. The types of methods available depend on the
288 type of image (see Image::Info for more details). These additional methods
289 will always include the following:
290 .Sh "file_media_type"
291 .IX Subsection "file_media_type"
292 This is the \s-1MIME\s0 type that is appropriate for the given file format.
293 The corresponding value is a string like: "\f(CW\*(C`image/png\*(C'\fR\*(L" or \*(R"\f(CW\*(C`image/jpeg\*(C'\fR".
295 .IX Subsection "file_ext"
296 The is the suggested file name extention for a file of the given
297 file format. The value is a 3 letter, lowercase string like
298 "\f(CW\*(C`png\*(C'\fR\*(L", \*(R"\f(CW\*(C`jpg\*(C'\fR".
300 .IX Subsection "color_type"
301 The value is a short string describing what kind of values the pixels
302 encode. The value can be one of the following:
314 These names can also be prefixed by "\f(CW\*(C`Indexed\-\*(C'\fR\*(L" if the image is
315 composed of indexes into a palette. Of these, only \*(R"\f(CW\*(C`Indexed\-RGB\*(C'\fR" is
318 (It is similar to the \s-1TIFF\s0 field PhotometricInterpretation, but this
319 name was found to be too long, so we used the \s-1PNG\s0 inpired term
322 .IX Subsection "resolution"
323 The value of this field normally gives the physical size of the image
324 on screen or paper. When the unit specifier is missing then this field
325 denotes the squareness of pixels in the image.
327 The syntax of this field is:
331 \& <xres> "/" <yres> <unit>
335 The \f(CW\*(C`<res>\*(C'\fR, \f(CW\*(C`<xres>\*(C'\fR and \f(CW\*(C`<yres>\*(C'\fR fields are
336 numbers. The \f(CW\*(C`<unit>\*(C'\fR is a string like \f(CW\*(C`dpi\*(C'\fR, \f(CW\*(C`dpm\*(C'\fR or
337 \&\f(CW\*(C`dpcm\*(C'\fR (denoting "dots per inch/cm/meter).
338 .Sh "SamplesPerPixel"
339 .IX Subsection "SamplesPerPixel"
340 This says how many channels there are in the image. For some image
341 formats this number might be higher than the number implied from the
342 \&\f(CW\*(C`color_type\*(C'\fR.
344 .IX Subsection "BitsPerSample"
345 This says how many bits are used to encode each of samples. The value
346 is a reference to an array containing numbers. The number of elements
347 in the array should be the same as \f(CW\*(C`SamplesPerPixel\*(C'\fR.
349 .IX Subsection "Comment"
350 Textual comments found in the file. The value is a reference to an
351 array if there are multiple comments found.
353 .IX Subsection "Interlace"
354 If the image is interlaced, then this returns the interlace type.
356 .IX Subsection "Compression"
357 This returns the name of the compression algorithm is used.
359 .IX Subsection "Gamma"
360 A number indicating the gamma curve of the image (e.g. 2.2)
363 Andy Wardley <abw@wardley.org> <http://wardley.org/>
365 .IX Header "COPYRIGHT"
366 Copyright (C) 1996\-2007 Andy Wardley. All Rights Reserved.
368 This module is free software; you can redistribute it and/or
369 modify it under the same terms as Perl itself.
371 .IX Header "SEE ALSO"
372 Template::Plugin, Image::Info