The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Rudesind::Gallery - A gallery which may contain both images and other galleries

SYNOPSIS

  use Rudesind::Gallery;

  my $gallery = Rudesind::Gallery->new( path => '/', config => $config );

  foreach my $img ( $gallery->images ) { ... }

DESCRIPTION

This class represents a gallery. A gallery can contain both images as well as other galleries.

CONSTRUCTOR

The new() method requires two parameters:

  • path

    The URI path for the gallery. The top-level gallery will always have be /.

  • config

    A Rudesind::Config object.

If no filesystem directory matches the given path, then the constructor returns false.

METHODS

This class provides the following methods:

  • path()

    The URI path for this gallery.

  • uri()

    The same value as path(). Provided for the use of the Mason UI. Use path() instead.

  • title()

    A title for the gallery. Currently, this is just the last portion of the path, or "top" if the path is /.

  • config()

    The Rudesind::Config object given to the constructor.

  • subgalleries()

    Returns a list of Rudesind::Gallery objects, each of which is a gallery contained by the object this method is called on.

    The list is sorted by title (the last portion of the gallery's path).

  • images()

    Returns a list of Rudesind::Image objects, each of which is an image contained by the object this method is called on.

    The list is sorted by title (the image file's name).

  • image($filename)

    Given a filename (without a path), this method returns a new Rudesind::Image object for that image. Tihs is the constructor for image objects.

    If no such file exists in the gallery, then this method returns a false value.

  • previous_image($image)

  • next_image($image)

    Given an image object, these methods return the previous or next image object in the gallery, if one exists.

Captions

This class uses the Rudesind::Captioned role.