NAME

Catalyst::Controller::AutoAssets::Handler::ImageSet - ImageSet type handler

SYNOPSIS

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">

DESCRIPTION

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.

CONFIG PARAMS

include_regex

Optional regex ($string) to require files to match to be included.

Defaults to '\.(png|jpg|jpeg|gif|bmp|tif|tiff)$'

regex_ignore_case

Whether or not to use case-insensitive regex (qr/$regex/i vs qr/$regex/) when evaluating include_regex/exclude_regex.

Defaults to true (1).

flatten_paths

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.

Defaults to false (0).

METHODS

img_tag

Convenience method to return an HTML img tag for the supplied image/path.

img_tag_title

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.

dump_all_img_tags

Dumps img tags for every image in the asset

SEE ALSO

Catalyst::Controller::AutoAssets
Catalyst::Controller::AutoAssets::Handler
Catalyst::Controller::AutoAssets::Handler::Directory
Catalyst::Controller::AutoAssets::Handler::IconSet

AUTHOR

Henry Van Styn <vanstyn@cpan.org>

COPYRIGHT AND LICENSE

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.