Catalyst::Controller::AutoAssets::Handler::ImageSet - ImageSet type handler
In your controller:
package MyApp::Controller::Assets::MyImages; use parent 'Catalyst::Controller::AutoAssets'; 1;
Then, in your .conf:
<Controller::Assets::MyImages> include root/images/ type ImageSet flatten_paths 1 include_regex '\.(png|jpg|gif)$' </Controller::Assets::MyImages>
And in your .tt files:
[% c.controller('Assets::MyImages').img_tag('foo.png') %] <img src="[% c.controller('Assets::MyImages').asset_path('apple.jpg') %]">
Or, in static HTML:
<img src="/assets/myimages/current/apple.jpg">
Like the 'Directory' asset type but with some extra options, defaults and functionality specific to images.
This class extends Catalyst::Controller::AutoAssets::Handler::Directory. Only differences are shown below.
Optional regex ($string) to require files to match to be included.
Defaults to '\.(png|jpg|jpeg|gif|bmp|tif|tiff|svg)$'
'\.(png|jpg|jpeg|gif|bmp|tif|tiff|svg)$'
Whether or not to use case-insensitive regex (qr/$regex/i vs qr/$regex/) when evaluating include_regex/exclude_regex.
qr/$regex/i
qr/$regex/
Defaults to true (1).
Whether or not to convert paths to filenames (i.e. 'path/to/apple.jpg' becomes 'apple.jpg') for shorter and easier names. Duplicate filenames ignored (only the first will be used) with a warning in the log.
'path/to/apple.jpg'
'apple.jpg'
Defaults to false (0).
Convenience method to return an HTML img tag for the supplied image/path.
Convenience method to return an HTML img tag for the supplied image/path with the 'title' attribute (i.e. for mouse-over) set to the path.
Dumps img tags for every image in the asset
Henry Van Styn <vanstyn@cpan.org>
This software is copyright (c) 2013 by IntelliTree Solutions llc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Catalyst::Controller::AutoAssets, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Controller::AutoAssets
CPAN shell
perl -MCPAN -e shell install Catalyst::Controller::AutoAssets
For more information on module installation, please visit the detailed CPAN module installation guide.