Catalyst::View::GD::Thumbnail - Catalyst view to resize images for thumbnails
Create a thumbnail view: script/myapp_create view Thumbnail Thumbnail Then in your controller: sub thumbnail :Local :Args(1) { my ($self, $c, $image_file_path) = @_; $c->stash->{thumbnail}{x} = 100; # Create a 100px wide thumbnail #or $c->stash->{thumbnail}{y} = 100; # Create a 100px tall thumbnail $c->stash->{thumbnail}{image} = $image_file_path; $c->forward('View::Thumbnail'); }
Catalyst::View::GD::Thumbnail resizes images to produce thumbnails, with options to set the desired x or y dimensions. Uses the GD image library for those who are already using something more advanced than Imager.
The view is controlled by setting the following values in the stash:
Contains the file path for the full-size source image.
This is a mandatory option.
The width (in pixels) of the thumbnail.
This is optional, but at least one of the x or y parameters must be set.
x
y
The height (in pixels) of the thumbnail.
The generated thumbnails will always be produced in the same format (PNG, JPG, etc) as the source image.
Catalyst::View::GD::Thumbnail uses the Image::Resize module to crop and resize images, so it accept any image format supported by Image::Resize: bmp, gif, jpeg, png, xbm, xpm.
Please see the Image::Resize documentation for more details and installation notes.
Please report any bugs or feature requests to bug-catalyst-view-thumbnail at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-View-GD-Thumbnail. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-catalyst-view-thumbnail at rt.cpan.org
Nick Logan (ugexe) <nlogan@gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::View::GD::Thumbnail, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::View::GD::Thumbnail
CPAN shell
perl -MCPAN -e shell install Catalyst::View::GD::Thumbnail
For more information on module installation, please visit the detailed CPAN module installation guide.