| 1 | package AxKit::App::Gallery; | ||
| 2 | |||
| 3 | # Copyright (c) 2003 Nik Clayton | ||
| 4 | # All rights reserved. | ||
| 5 | # | ||
| 6 | # Redistribution and use in source and binary forms, with or without | ||
| 7 | # modification, are permitted provided that the following conditions | ||
| 8 | # are met: | ||
| 9 | # 1. Redistributions of source code must retain the above copyright | ||
| 10 | # notice, this list of conditions and the following disclaimer. | ||
| 11 | # 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | # notice, this list of conditions and the following disclaimer in the | ||
| 13 | # documentation and/or other materials provided with the distribution. | ||
| 14 | # | ||
| 15 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
| 16 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 17 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 18 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 19 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 20 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 21 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 22 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 23 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 24 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 25 | # SUCH DAMAGE. | ||
| 26 | # | ||
| 27 | # $Id: Gallery.pm,v 1.5 2004/02/26 14:09:52 nik Exp $ | ||
| 28 | |||
| 29 | use vars qw/$VERSION/; | ||
| 30 | |||
| 31 | $VERSION = 0.5; | ||
| 32 | |||
| 33 | =head1 NAME | ||
| 34 | |||
| 35 | AxKit::App::Gallery - web based image galleries using AxKit | ||
| 36 | |||
| 37 | =head1 SYNOPSIS | ||
| 38 | |||
| 39 | AxAddPlugin AxKit::App::Gallery::Plugin | ||
| 40 | AxContentProvider AxKit::App::Gallery::Provider | ||
| 41 | |||
| 42 | # Many AxAddRootProcessor statements to map root elements to | ||
| 43 | # stylesheets | ||
| 44 | |||
| 45 | # ... | ||
| 46 | |||
| 47 | =head1 DESCRIPTION | ||
| 48 | |||
| 49 | AxKit::App::Gallery is a collection of Perl modules, XSLT stylesheets, and | ||
| 50 | XPathScript stylesheets that implement a web-based image gallery. The gallery | ||
| 51 | is generated on the fly, with intelligent caching. | ||
| 52 | |||
| 53 | Out of the box, the gallery generates two types of web page. The first is a | ||
| 54 | 'proofsheet', a collection of image thumbnails. The second is an | ||
| 55 | 'imagesheet', which contains a single image (which may be viewed at a number | ||
| 56 | of different resolutions, depending on the gallery's configuration), and | ||
| 57 | additional information about the image (size, date and time it was taken, and | ||
| 58 | so on). | ||
| 59 | |||
| 60 | This manual page provides an introduction to the application, and how to | ||
| 61 | configure it once it has been installed. People interested in extending | ||
| 62 | AxKit::App::Gallery (::Gallery from here on in) should see the manual pages | ||
| 63 | for AxKit::App::Gallery::Plugin, AxKit::App::Gallery::Provider, and | ||
| 64 | AxKit::App::Gallery::stylesheets for further information. | ||
| 65 | |||
| 66 | =head1 GALLERY CONFIGURATION | ||
| 67 | |||
| 68 | You should collect your images in to one or more directory hierarchies. The | ||
| 69 | directories should contain images, and (optionally) sub-directories with more | ||
| 70 | images. ::Gallery ignores any non-image files (that is, their MIME type does | ||
| 71 | not start 'image/'). These images may already be under your webserver's | ||
| 72 | document root, or you can use an C<Alias> directive to point to them. | ||
| 73 | |||
| 74 | You also need to set aside some space for ::Gallery's cache. This is separate | ||
| 75 | from AxKit's cache location. ::Gallery will create directories and files in | ||
| 76 | this cache, so the cache directory must be writable by the same user under | ||
| 77 | which you run the webserver. | ||
| 78 | |||
| 79 | =head1 APACHE CONFIGURATION | ||
| 80 | |||
| 81 | =head2 Create a directory for the stylesheets | ||
| 82 | |||
| 83 | The contents of the F<stylesheets/> directory must be copied to somewhere | ||
| 84 | the web server can read them. | ||
| 85 | |||
| 86 | =head2 httpd.conf directives | ||
| 87 | |||
| 88 | The root of the directory hierarchy that contains the images must be | ||
| 89 | configured in Apache. The F<httpd/> directory contains a commented | ||
| 90 | httpd.conf file. You should add the contents of that file to your Apache | ||
| 91 | configuration. | ||
| 92 | |||
| 93 | =head2 Configure the gallery | ||
| 94 | |||
| 95 | Now supply the gallery's configuration options. These are Perl variables, | ||
| 96 | set using C<PerlSetVar>. The available options are: | ||
| 97 | |||
| 98 | =over 4 | ||
| 99 | |||
| 100 | =item ProofSheetColumns | ||
| 101 | |||
| 102 | The default proofsheet2html.xsl stylesheet organises the images on the | ||
| 103 | proofsheet in to a table, C<n> columns wide. Use this variable to specify | ||
| 104 | how many columns to use. The default is C<4>. | ||
| 105 | |||
| 106 | PerlSetVar ProofSheetColumns 6 | ||
| 107 | |||
| 108 | =item ImagesPerProofsheet | ||
| 109 | |||
| 110 | The default proofsheet2html.xsl stylesheet will break the proofsheet up in | ||
| 111 | to multiple pages if it contains too many images. Use this variable to | ||
| 112 | specify how many images to place per page. The default is C<16>. | ||
| 113 | |||
| 114 | PerlSetVar ImagesPerProofsheet 20 | ||
| 115 | |||
| 116 | =item GalleryCache | ||
| 117 | |||
| 118 | The stylesheets cache the metadata and thumbnails that are generated for | ||
| 119 | each image. Use this variable to specify the cache directory. Additional | ||
| 120 | subdirectories will be created in this directory as necessary. There is | ||
| 121 | no default. | ||
| 122 | |||
| 123 | PerlSetVar GalleryCache /var/tmp/ax-app-gallery | ||
| 124 | |||
| 125 | =item GallerySizes | ||
| 126 | |||
| 127 | The default stylesheets allow the user to view the images in a number of | ||
| 128 | different sizes. This variable is a space-separated string of sizes. | ||
| 129 | Each size specifies that the longest dimension of the image (either its | ||
| 130 | width, if it's in landscape orientation, or its height, if it's in | ||
| 131 | portrait orientation) will be scaled to this size. | ||
| 132 | |||
| 133 | The first two numbers in this list have special significance. The first | ||
| 134 | number is used to scale the thumbnails that are generated on the | ||
| 135 | proofsheet. The second is the default size of the image that will be | ||
| 136 | shown if the user clicks through on an image on a proofsheet to its | ||
| 137 | associated <imagesheet> page. | ||
| 138 | |||
| 139 | The size may also be C<full>, in which case the end user will be allowed | ||
| 140 | to download a copy of the original image. | ||
| 141 | |||
| 142 | For example, setting this to | ||
| 143 | |||
| 144 | 133 640 800 1024 full | ||
| 145 | |||
| 146 | (which is also the default) says that: | ||
| 147 | |||
| 148 | =over 4 | ||
| 149 | |||
| 150 | =item * | ||
| 151 | |||
| 152 | Thumbnails on the proofsheet will be scaled so that the longest dimension | ||
| 153 | in each image is 133 pixels. | ||
| 154 | |||
| 155 | =item * | ||
| 156 | |||
| 157 | The image that is shown when the user clicks through on the <proofsheet> | ||
| 158 | will be scaled so that the longest dimension in the image is 640 pixels. | ||
| 159 | |||
| 160 | =item * | ||
| 161 | |||
| 162 | Sizes of 800 and 1024 pixels are also available. | ||
| 163 | |||
| 164 | =item * | ||
| 165 | |||
| 166 | The end user will be able to download a copy of the original image. | ||
| 167 | |||
| 168 | =back | ||
| 169 | |||
| 170 | By contrast, a setting of | ||
| 171 | |||
| 172 | 133 800 640 1024 full | ||
| 173 | |||
| 174 | is identical, except that the default image size after clicking an image | ||
| 175 | on the proofsheet is 800 pixels, not 640 pixels. 640 pixels is still | ||
| 176 | available as an option to the end user. | ||
| 177 | |||
| 178 | PerlSetVar GallerySizes '133 800 640 1024 full' | ||
| 179 | |||
| 180 | =item GalleryThumbQuality | ||
| 181 | |||
| 182 | This specifies the quality of the thumbnails that are produced. The | ||
| 183 | default setting, C<normal>, is passed to L<Imager::Transformations> when | ||
| 184 | scaling the image to create the thumbnails. This can be set to | ||
| 185 | C<preview>, which speeds up the thumbnail generation at the expense of the | ||
| 186 | image quality. See L<Imager::Transformations> and the C<qtype> parameter | ||
| 187 | for more information. | ||
| 188 | |||
| 189 | PerlSetVar GalleryThumbQuality preview | ||
| 190 | |||
| 191 | =back | ||
| 192 | |||
| 193 | =head1 TESTING | ||
| 194 | |||
| 195 | That should be all you need to do. So restart Apache, and point your web | ||
| 196 | browser at the AxKit::App::Gallery enabled URL. | ||
| 197 | |||
| 198 | =head1 SEE ALSO | ||
| 199 | |||
| 200 | perl(1). AxKit | ||
| 201 | |||
| 202 | =head1 AUTHOR | ||
| 203 | |||
| 204 | Nik Clayton, nik@freebsd.org | ||
| 205 | |||
| 206 | =head1 BUGS | ||
| 207 | |||
| 208 | Undoubtedly. | ||
| 209 | |||
| 210 | =cut |