Cataly...ew::GD(3pm)
π Catalyst::View::GD β the manual, but make it slay π
okay so bestie, this is the perl doc for Catalyst::View::GD (you'll see it filed under Cataly...ew::GD(3pm) in the User Contributed Perl Documentation section β that truncated lil name is just how it shows up in the header, don't panic). It's giving β¨Catalyst View energyβ¨ and honestly? We're obsessed.
πΈ NAME πΈ
Catalyst::View::GD β a Catalyst View for GD images π
β¨ SYNOPSIS β¨
copy this, it's literally the whole vibe:
# lib/MyApp/View/GD.pm
package MyApp::View::GD;
use base 'Catalyst::View::GD';
1;
# configure in lib/MyApp.pm
MyApp->config({
...
'View::GD' => {
gd_image_type => 'png', # defaults to 'gif'
gd_image_content_type => 'images/png', # defaults to 'image/$gd_image_type'
gd_image_render_args => [ 5 ], # defaults to []
},
});
sub foo : Local {
my($self, $c) = @_;
$c->stash->{gd_image} = $self->create_foo_image();
$c->forward('MyApp::View::GD');
}
π¦ DESCRIPTION π¦
So basically: this is a Catalyst View subclass, and its whole job β its entire main character arc β is handling the rendering of GD based image content. πΌοΈ That's it. That's the gig. And it ate. π
π CONFIG OPTIONS π
gd_image_typeβ lowkey the important one. It defaults to"gif", but fr fr it should be the name of the method you call on theGD::Imageinstance to actually render the images. So like, whatever render method you want, that's what goes here. β¨gd_image_render_argsβ an array ref of values passed as an argument to theGD::Imagerender method. π¦ Just the args, chillin' in an arrayref.gd_image_content_typeβ ngl this one's got a built-in default: it's constructed from thegd_image_typeparameter, and in most cases that just works and you can move on with your life. BUT β some of the more specific rendering methods inGD::Imagewon't play nice with the auto-built one, and in those cases you will need to assign this explicitly. No cap. π«Ά
π METHODS π
newβ this really just handles consuming the configuration parameters. That's the whole personality. It eats config and moves on. πprocessβ the star of the show. This method will always look in the"gd_image"stash for an instance ofGD::Image, and then it renders and serves it according to however you set up the configuration. ποΈβ¨
And here's the cute part: you can also override the global configuration on a per-request basis by assigning values in the stash using the same keys you'd use in the configuration. So you're not locked into the global vibe β you can switch it up per request. π π
π BUGS π
okay so, real talk: all complex software has bugs lurking in it, and this module is no exception β it's not special, bestie, nobody's immune π. If you find a bug, please either email me, or add the bug to cpan-RT. Do it fr, don't just suffer in silence. π
π AUTHOR π
Stevan Little</purl> β stevan.little@iinteractive.com π
β COPYRIGHT AND LICENSE β
Copyright 2007 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. πͺπ
and that's the whole page bestie, you understood it, you ate, periodt π β¨
cute lil sign-off: this doc came to you from perl v5.32.0, dated 2021-01-08, filed under Cataly...ew::GD(3pm) β go render some images, you've got this ππ¦πΈ
π¦ where this page comes from
- debian bookworm: libcatalyst-view-gd-perl 0.1-1.2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatalyst-view-gd-perl 0.1-1.2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libcatalyst-view-gd-perl 0.1-1.2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-view-gd-perl 0.1-1.2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-view-gd-perl 0.1-1.2 Β· 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