use CGI::Uploader::Transform::ImageMagick;
As a class method:
($thumb_tmp_filename) = CGI::Uploader::Transform::ImageMagick->gen_thumb({ filename => $orig_filename, w => $width, h => $height });
Within a CGI::Uploader spec:
spec
gen_files => { my_thumb => gen_thumb({ w => $width, h => $height }), }
Looking for a different syntax? See "BACKWARDS COMPATIBILITY"
This function creates a copy of given image file and resizes the copy to the provided width and height.
gen_thumb can be called as object or class method. As a class method, there there is no need to call new() before calling this method.
gen_thumb
new()
Graphics::Magick is used as the first choice image service module. Image::Magick is tried next.
Input:
filename - filename of source image w - max width of thumbnail h - max height of thumbnail
One or both of w or h is required.
w
h
Output: - filename of generated tmp file for the thumbnail - the initialized image generation object. (You generally shouldn't need this)
These older, more awkward syntaxes are still supported:
($thumb_tmp_filename) = CGI::Uploader::Transform::ImageMagick->gen_thumb( $orig_filename, [ w => $width, h => $height ] );
In a CGI::Uploader spec:
CGI::Uploader
'my_img_field_name' => { transform_method => \&gen_thumb, params => [ w => 100, h => 100 ], }
1;
To install CGI::Uploader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Uploader
CPAN shell
perl -MCPAN -e shell install CGI::Uploader
For more information on module installation, please visit the detailed CPAN module installation guide.