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

NAME

AxKit::App::Gallery::stylesheets

DESCRIPTION

AxKit::App::Gallery works by generating XML, and then passing the generated XML through a collection of stylesheets. The output of one stylesheet is passed on as input to the next. In this way, a pipeline of stylesheets if formed.

Some of the stylesheets are written in XSLT, some are written in XPathScript. This manual page provides a brief description of the stylesheets that are shipped with AxKit::App::Gallery, in the order in which they are supposed to run. For further details, see the comments in the stylesheets.

STYLESHEETS FOR GENERATING THE PROOFSHEET

AxHandleDirs

Not strictly a stylesheet. The AxHandleDirs directive in the httpd.conf file configures AxKit to generate XML containing a list of the files and directories in a given directory.

scrubfilelist.xps

The filelist is scrubbed to remove files and directories that should not be processed. The rules are (note: check the code in case this has changed -- if it has, send in a bug report):

  • Remove all directories that start with a ., with the exception of the current directory, ..

  • Remove all files that start with a ..

  • Remove all files that are not images -- i.e., their MIME type does not start image/.

  • Remove all files that are unreadable.

sortfilelist.xsl

The file list may not be supported, with directories and files appearing in any order. The file list is sorted, with directories appearing first in alphabetical order, followed by files, in alphabetical order.

filelist2proofsheet.xsl

The remainder of the stylesheets work on building and formatting a proofsheet structure. This stylesheet builds the basic proofsheet structure, and does the initial population of the albums and images elements. See AxKit::App::Gallery::proofsheet for complete details of this format.

trimproofsheet.xps

::Gallery can be configured to display a maximum number of images per proofsheet. If there are too many images to display then the proofsheet is divided in to pages, and the end user can navigate between the pages.

Given the current page number, this stylesheet removes all the images from the proofsheet that would not appear on the current page.

In the out-of-the-box configuration, this stylesheet is placed here because some of the later stylesheets may be computationally expensive, so on a slow box you want to trim the list down to the minimum number of images that must be processed. On a faster box this can be placed later in the chain. This would speed up the appearance of subsequent pages from a large proofsheet. I haven't benchmarked it, but this speed up is likely to be negligible...

addconfig.xps

The XSLT stylesheets have no access to the gallery configuration variables that are specified in the Apache config file. Nor can they retrieve information about the query (its URI, and so forth). This XPathScript stylesheet retrieves this information, and plugs it in to the <proofsheet> structure so that subsequent XSLT stylesheets can use this information.

extractimageinfo.xps

Each image has meta-data associated with it. Image dimensions, EXIF data, and so on. This stylesheet checks to see whether or not this data should be extracted -- is the cached copy out of date? -- and if necessary extracts it and saves it in the correct cache directory to a file called imageinfo.xml.

mergeimageinfo.xsl

After the metadata has been extracted and cached, this stylesheet finds the cached metadata and incorporates it in to the document.

proofsheet2html.xsl

Finally, once the complete proofsheet has been compiled, it's converted to HTML. This stylesheet is intended to serve as an example. If you want to change the look and feel of the gallery proofsheet pages then this is the stylesheet to adjust.

STYLESHEETS FOR GENERATING THE IMAGESHEET

AxKit::App::Gallery::Provider

Not strictly a stylesheet. The ::Provider is run whenever one of the image files is requested, and AxKit::App::Gallery::Plugin returns OK (indicating that AxKit should process the request, instead of letting Apache serve the file).

The get_strref() method generates the initial XML <imagesheet> document. See AxKit::App::Gallery::imagesheet for complete documentation about this document and its structure.

mergeimageinfo.xsl

See the earlier description of mergeimageinfo.xsl.

imagesheet2html.xsl

Once the complete imagesheet has been compiled, it's converted to HTML. This stylesheet is intended to server as an example. If you want to change the look and feel of the gallery imagesheet pages then this is the stylesheet to adjust.

imagesheet2html.xsl

SEE ALSO

AxKit::App::Gallery, AxKit::App::Gallery::proofsheet, AxKit::App::Gallery::imagesheet, AxKit::App::Gallery::Plugin, AxKit::App::Gallery::Provider

AUTHOR

Nik Clayton, nik@FreeBSD.org

BUGS

Undoubtedly.