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

NAME

Rudesind - A Mason-based image gallery

SYNOPSIS

  PerlModule Rudesind::Handler

  <Location /Rudesind>
    SetHandler perl-script
    PerlHandler Rudesind::Handler
  </Location>

  <Location /images>
    SetHandler default-handler
  </Location>

  <Location /image-cache>
    SetHandler default-handler
  </Location>

DESCRIPTION

Rudesind is a Mason-based image gallery program. It provides image and gallery captioning, and on-the-fly thumbnails and image manipulation. Generated images are cached and subsequently served without using Mason, in order to improve the speed of the application.

CONFIGURATION

Rudesind is configured in two files. First in its own Rudesind.conf config file. When Rudesind is installed, it will write a boilerplate config to a location of your choosing. The boilerplate config file contains a detailed description of all of the possible configuration parameters.

Of these, the most important are the "root_dir", "uri_root", "raw_image_subdir" and "image_uri_root" parameters.

For the following examples, we will assume that we have a document root of /var/www, and the following Rudesind configuration:

root_dir

/var/www/gallery

uri_root

/Rudesind

raw_image_subdir

images

image_uri_root

gallery

Making Images Available

To make an image available in the gallery, we can place them under the directory defined by concatenating our "root_dir" and "raw_image_subdir", /var/www/gallery/images. You can create a hierarchy of galleries under this directory as you see fit. Images are displayed sorted ASCII-betically by filename.

Setting the Configuration File Location

By default, Rudesind will look for the configuration file in the following locations:

  • $ENV{RUDESIND_CONFIG}

  • $ENV{HOME}/.Rudesind.conf

  • /etc/Rudesind.conf

  • /etc/Rudesind/Rudesind.conf

  • /opt/Rudesind/Rudesind.conf

You can have multiple configuratoins with a single server by using PerlSetEnv RUDESIND_CONFIG in different Apache configuration blocks.

Apache/mod_perl Configuration

The Rudesind::Handler module will server Mason components based on a virtual URL, defined by your "uri_root" parameter.

If your "uri_root" is "/Rudesind", then your Apache configuration should look like this:

  <Location /Rudesind>
    SetHandler perl-script
    PerlHandler Rudesind::Handler
  </Location>

You also need to set up a handler for the "image_uri_root" URI. Images go into the directory defined by the "raw_image_subdir" parameter. So if this is set to images, they will go into /var/www/gallery/images. The image cache files are stored under the root directory in an image-cache directory. So they will be in /var/www/gallery/image-cache.

We want to serve all of these images with the default handler.

  # This location corresponds to our "image_uri_root"
  <Location /gallery>
    SetHandler default-handler
  </Location>

Two Apache Configuration

Rudesind also works well when using two Apache servers, with a frontend non-mod_perl server proxying some requests to a backend mod_perl server. Our front-end configuration would just look like this:

  RewriteRule ^(/Rudesind.*)  http://localhost:12345$1  [P,L]

Since our images are located under the server's document root, the will be served by the front end server without any additional configuration needed.

Then our back end configuration just needs this piece:

  <Location /Rudesind>
    SetHandler perl-script
    PerlHandler Rudesind::Handler
  </Location>

ADMIN AUTHORIZATION

Rudesind allows you to login as an admin in order to edit gallery and image captions. There are two ways this can be done. The simplest is to set an "admin_password" parameter in the Rudesind configuration file. You will then be prompted for this password when you click on the "admin" link.

You may prefer to use HTTP basic authentication instead. In that case, you should configure Apache to protect the /admin directory under your "uri_root" (/Rudesind/admin in our example) URI with basic authentication. If you access the admin area after authenticating yourself via HTTP basic auth, then you will be given admin access.