Nik Clayton


AxKit::App::Gallery - web based image galleries using AxKit


  AxAddPlugin       AxKit::App::Gallery::Plugin
  AxContentProvider AxKit::App::Gallery::Provider

  # Many AxAddRootProcessor statements to map root elements to
  # stylesheets

  # ...


AxKit::App::Gallery is a collection of Perl modules, XSLT stylesheets, and XPathScript stylesheets that implement a web-based image gallery. The gallery is generated on the fly, with intelligent caching.

Out of the box, the gallery generates two types of web page. The first is a 'proofsheet', a collection of image thumbnails. The second is an 'imagesheet', which contains a single image (which may be viewed at a number of different resolutions, depending on the gallery's configuration), and additional information about the image (size, date and time it was taken, and so on).

This manual page provides an introduction to the application, and how to configure it once it has been installed. People interested in extending AxKit::App::Gallery (::Gallery from here on in) should see the manual pages for AxKit::App::Gallery::Plugin, AxKit::App::Gallery::Provider, and AxKit::App::Gallery::stylesheets for further information.


You should collect your images in to one or more directory hierarchies. The directories should contain images, and (optionally) sub-directories with more images. ::Gallery ignores any non-image files (that is, their MIME type does not start 'image/'). These images may already be under your webserver's document root, or you can use an Alias directive to point to them.

You also need to set aside some space for ::Gallery's cache. This is separate from AxKit's cache location. ::Gallery will create directories and files in this cache, so the cache directory must be writable by the same user under which you run the webserver.


Create a directory for the stylesheets

The contents of the stylesheets/ directory must be copied to somewhere the web server can read them.

httpd.conf directives

The root of the directory hierarchy that contains the images must be configured in Apache. The httpd/ directory contains a commented httpd.conf file. You should add the contents of that file to your Apache configuration.

Now supply the gallery's configuration options. These are Perl variables, set using PerlSetVar. The available options are:


The default proofsheet2html.xsl stylesheet organises the images on the proofsheet in to a table, n columns wide. Use this variable to specify how many columns to use. The default is 4.

    PerlSetVar ProofSheetColumns 6

The default proofsheet2html.xsl stylesheet will break the proofsheet up in to multiple pages if it contains too many images. Use this variable to specify how many images to place per page. The default is 16.

    PerlSetVar ImagesPerProofsheet 20

The stylesheets cache the metadata and thumbnails that are generated for each image. Use this variable to specify the cache directory. Additional subdirectories will be created in this directory as necessary. There is no default.

    PerlSetVar GalleryCache /var/tmp/ax-app-gallery

The default stylesheets allow the user to view the images in a number of different sizes. This variable is a space-separated string of sizes. Each size specifies that the longest dimension of the image (either its width, if it's in landscape orientation, or its height, if it's in portrait orientation) will be scaled to this size.

The first two numbers in this list have special significance. The first number is used to scale the thumbnails that are generated on the proofsheet. The second is the default size of the image that will be shown if the user clicks through on an image on a proofsheet to its associated <imagesheet> page.

The size may also be full, in which case the end user will be allowed to download a copy of the original image.

For example, setting this to

    133 640 800 1024 full

(which is also the default) says that:

  • Thumbnails on the proofsheet will be scaled so that the longest dimension in each image is 133 pixels.

  • The image that is shown when the user clicks through on the <proofsheet> will be scaled so that the longest dimension in the image is 640 pixels.

  • Sizes of 800 and 1024 pixels are also available.

  • The end user will be able to download a copy of the original image.

By contrast, a setting of

    133 800 640 1024 full

is identical, except that the default image size after clicking an image on the proofsheet is 800 pixels, not 640 pixels. 640 pixels is still available as an option to the end user.

    PerlSetVar GallerySizes '133 800 640 1024 full'

This specifies the quality of the thumbnails that are produced. The default setting, normal, is passed to Imager::Transformations when scaling the image to create the thumbnails. This can be set to preview, which speeds up the thumbnail generation at the expense of the image quality. See Imager::Transformations and the qtype parameter for more information.

    PerlSetVar GalleryThumbQuality preview


That should be all you need to do. So restart Apache, and point your web browser at the AxKit::App::Gallery enabled URL.


perl(1). AxKit


Nik Clayton,