Creating thumbnail images with Catalyst

View: New views
1 Messages — Rating Filter:   Alert me  

Creating thumbnail images with Catalyst

by JJ-30 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

A couple of days ago I released Catalyst::View::Thumbnail, which
provides an easy way to serve thumbnail images. It should work with
any model that can put raw image data onto the stash (you don't need
the MIME type, it's automatically detected), so a controller to
produce thumbnails 100px high would look like this:

sub thumbnail :Local :Args(1) {
   my ($self, $c, $filename) = @_;

   $c->stash->{image} = $c->model('Images')->slurp($filename);
   $c->stash->{y}     = 100;

   $c->forward('View::Thumbnail');
}

Have a read of the tutorial at
http://perl.jonallen.info/writing/articles/creating-thumbnails-with-catalyst,
and please let me know of any fearure requests or bug reports.

The source code is on GitHub at
http://github.com/jonallen/Catalyst-View-Thumbnail/tree/master, you
can get the module from
http://perl.jonallen.info/projects/catalyst-view-thumbnail or download
it from CPAN.


Cheers,

JJ


P.S.
I originally posted this on my use.perl.org blog, but thought it may
be of interest here as well.

--
JJ <jj@...> - freelance Perl / Catalyst developer
http://perl.jonallen.info :: http://perldoc.perl.org

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/