CGI::U...eMagick(3pm)
β¨ CGI::Uploader::Transform::ImageMagick β¨
okay so bestie, this is the perl doc for CGI::Uploader::Transform::ImageMagick β and what it does is generate thumbnails with ImageMagick. iconic behavior honestly π
π METHODS π
π gen_thumb() π
first thing's first, you gotta pull the module in:
use CGI::Uploader::Transform::ImageMagick;
πΈ calling it as a class method πΈ
($thumb_tmp_filename) = CGI::Uploader::Transform::ImageMagick->gen_thumb({
filename => $orig_filename,
w => $width,
h => $height
});
π¦ calling it inside a CGI::Uploader "spec" π¦
gen_files => {
my_thumb => gen_thumb({ w => $width, h => $height }),
}
looking for a different syntax? π go check out BACKWARDS COMPATIBILITY down below, i gotchu.
so what does this function actually do? it makes a copy of the image file you hand it, and resizes that copy to the width and height you gave it. that's it, that's the whole vibe β¨
gen_thumb can be called as an object method or as a class method. and if you're calling it as a class method? no cap, you do not need to call new() first β just go straight in, main character energy, no warm-up π«Ά
Graphics::Magick is the first choice image service module. if that's not around, it tries Image::Magick next. backup plans, we love to see it π
π Input: π
filenameβ filename of source imagewβ max width of thumbnailhβ max height of thumbnail
one or both ofworhis required. like, you genuinely cannot skip both, bestie π
β Output: β
- filename of generated tmp file for the thumbnail
- the initialized image generation object. (you generally shouldn't need this)
π BACKWARDS COMPATIBILITY π
these older, more awkward syntaxes are still supported β yes even the crusty ones, we don't gatekeep π
as a class method:
($thumb_tmp_filename) = CGI::Uploader::Transform::ImageMagick->gen_thumb(
$orig_filename,
[ w => $width, h => $height ]
);
in a CGI::Uploader "spec":
'my_img_field_name' => {
transform_method => \&gen_thumb,
params => [ w => 100, h => 100 ],
}
and the lil classic that every perl module ends on:
1;
k bye bestie, go make some thumbnails π
this page came from the User Contributed Perl Documentation, it's perl v5.34.0, dated 2022-06-10, and the file itself is CGI::U...eMagick(3pm) β yes the name got cropped, she's mysterious like that π
β¨
π¦ where this page comes from
- debian bookworm: libcgi-uploader-perl 2.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcgi-uploader-perl 2.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcgi-uploader-perl 2.18-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms