Andrey Gatitskiy

NAME

Mojolicious::Plugin::Thumbnail - Mojolicious Plugin

SYNOPSIS

  # Mojolicious
  $self->plugin('Thumbnail');

  # Mojolicious::Lite
  plugin 'Thumbnail';

  # limit width, auto height
  $self->thumbnail(
    src   => 'public/img/img.jpg',
    dst   => 'public/img/img_thumb.jpg',
    width => 150,
  );

  # limit height, auto width
  $self->thumbnail(
    src   => 'public/img/img.jpg',
    dst   => 'public/img/img_thumb.jpg',
    width => 150,
  );

  # Resize and crop
  $self->thumbnail(
    src    => 'public/img/img.jpg',
    dst    => 'public/img/img_thumb.jpg',
    width  => 150,
    height => 150
  );

DESCRIPTION

Mojolicious::Plugin::Thumbnail is a simple plugin for fast creating thumbnails using Imager.

METHODS

Mojolicious::Plugin::Thumbnail inherits all methods from Mojolicious::Plugin and implements the following new ones.

Supported parameters:

  • src – Source image path

  • dst – Destination image path (default: /path/to/sourcefilename_thumb.ext)

  • width – The new width of the image

  • height – The new height of the image

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicio.us.