Cataly...ew::GD(3pm)

πŸ“¦
version 0.1 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– 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 the GD::Image instance 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 the GD::Image render 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 the gd_image_type parameter, and in most cases that just works and you can move on with your life. BUT β€” some of the more specific rendering methods in GD::Image won'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 of GD::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 2007 by Infinity Interactive, Inc.

<http://www.iinteractive.com>

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