---
name: "Catalyst::View::GD"
section: "3pm"
platform: "linux"
package: "libcatalyst-view-gd-perl"
version: "0.1-1.2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catalyst::View::GD"
---

# Catalyst::View::GD(3pm)

A Catalyst View for GD images

## NAME

Catalyst::View::GD - A Catalyst View for GD images

## SYNOPSIS

```
  # 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

This is a Catalyst View subclass which can handle rendering GD based  image content.

## CONFIG OPTIONS

- *gd\_image\_type*

  This defaults to `"gif"` but should be the name of the method to call on the  GD::Image instance in order to render the images.

- *gd\_image\_render\_args*

  This is an array ref of values to be passed as an argument to the GD::Image  render method.

- *gd\_image\_content\_type*

  The default for this is built from the `"gd_image_type"` parameter, which in  most cases will just work, but in some more specific rendering methods in  GD::Image it will not and you will need to assign this explicitly.

## METHODS

- **new**

  This really just handles consuming the configuration parameters.

- **process**

  This method will always look in the `"gd_image"` stash for an instance of  GD::Image and it will then render and serve it according to the  configuration setup.

  It is also possible to override the global configuration on a per-request  basis by assigning values in the stash using the same keys as used in  the configuration.

## BUGS

All complex software has bugs lurking in it, and this module is no  exception. If you find a bug please either email me, or add the bug to cpan-RT.

## AUTHOR

Stevan Little \<stevan.little@iinteractive.com\>

## COPYRIGHT AND LICENSE

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.
