20 Jan 2009 00:05:51 UTC
- Distribution: Catalyst-Plugin-Images
- Module version: 0.02
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (239 / 213 / 10)
- KwaliteeBus factor: 7
- % Coverage
- License: perl_5
- Perl: v5.8.1
- Activity24 month
- Download (21.78KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
Catalyst::Plugin::Images - Generate image tags for static files.
use Catalyst qw/ Images /; # ... somewhere in your templates [% c.image_tag("foo.png", alt => "alt text") %];
This plugin provides a quick and easy way to include your images on the page, automatically extracting and caching image metadata. It's automatically extendable, just pass whatever attribute you require as a key/value pair, and it will be added to the image tag. It will also look through a preset of folders so that you don't have to specify the full address to your image.
- image_tag $basename, %attrs
This method generates an image tag for the image named $basename, with the extra tags %attr automatically added to the resulting HTML tag. If you don't specify height/width, it will be autodetected from the image.
- get_image_info $basename
Retrieve the information about the image either from the cache or by searching for it.
- find_image_file $basename
Look inside all the search paths (see "CONFIGURATION") for an image named $basename, and return the full path to it, as a <Path::Class::File> object..
- read_image_info $path
Given the full path, as a Path::Class::File object, return the attributes to be added to the image. This returns a list with
- image_path_to_uri $path, $basename
see "CACHING IMAGE DATA" below.
Overridden to seed configuration defaults.
All configuration information is stored under the
It defaults to
This is the "base" prefix path for URI generation. For example, if an image was found at
/wwwthen the URI generated with
Catalyst/uri_forwill be for
The code will call
set_cached_image_infowhen appropriate. Currently both these operations are no op. You should override this if you care.
get_cached_image_inforeceives the base name, and should return the info hash.
set_cached_image_inforeceives the base name, and the info hash. It can use this data to expire the cache based on mtime, etc. The info hash contains the keys
Last released by Tomas Doran,
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Catalyst::Plugin::Images, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Catalyst::Plugin::Images
For more information on module installation, please visit the detailed CPAN module installation guide.