NAME

Blosxom Plug-in: photogallery

REQUIREMENTS

 Image::Magick, CGI, Digest::MD5
 Some configuration required

SYNOPSIS

The photogallery plug-in for Blosxom enables the Blosxom CGI to automatically display a directory full of images at various resolutions.

This plug-in enables two new story views. The default view generates a list of thumbnails for all the image files in a directory, and the single image view displays a larger version along with navigation buttons.

Images are stored in standard Blosxom content directories. Simply put all of the images you would like to display in a directory and add a either a flavour (e.g. story.html) or a text file (e.g., gallery.txt) in that directory to enable that gallery. You can have other story files about the same event in the same directory as the images and the gallery story.

To make the display of scaled images efficient, a reduced size thumbnail is automatically generated and cached if necessary when a gallery page is viewed. The generated images are cached in a directory that is publicly accessible via the web browser.

INSTALLATION

You will likely need to change two configuration variables in this script. First, set $image_dir to the location of a directory on your filesystem that can be read and written by your web server (and only your web server, you do not want it to be world writable). This directory is where photogallery will generate and cache resized images as necessary.

Second, set $public_url to the location at which that directory will appear when being served. It is likely that this will be outside your Blosxom data directory, as you want your web server to serve the file directly, rather than going through the blosxom.cgi.

A good way to do this under Apache is to employ an alias, for instance if $image_dir is set to /var/cache/blosxom/photogallery and you choose http://mysite/cache_gallery as the URL to access the cache directory:

  Alias /cache_gallery /var/cache/blosxom/photogallery

In other words, $image_dir and $public_url are the same directory, but seen firstly from the local filesystem point of view and secondly from a web client point of view

This directory will need to be writable by the same user/group that runs your web server.

USING PHOTOGALLERY

Displaying your galleries

To display the photogallery if you have for instance a 'gallery' heirarchy, you can simply add this line to your gallery category's story.html (or whatever story.flavour you prefer):

  $photogallery::photogallery

You might write another story.flavour which omits the plugin but shows a representative image plus link, to offer a low-graphics flavour if you have a site with many galleries.

Instead of putting it in a directory template, you may prefer to add

  $photogallery::photogallery

to a story.txt file such as gallery.txt in each directory where you have illustrations for a story. This has some advantages in that you can add the title, meta options and even write a surrounding story all in one place, but requires programming something like interpolate_fancy or storystate plugins to provide a low graphics flavour.

Captions

Captions for individual images can be displayed by adding a readable text file (default "captions.pg", can be changed in the configuration above) in each photo directory with the format:

  [image name]: [caption]

For example:

  IMG_3022: my cat, fluffy
  IMG_3023: another picture of my cat, fluffy
  IMG_3024: yet another picture of my cat, fluffy

If you have existing galleries with igal and you want to bring them under Blosxom easily, you can configure Photogallery to read the igal captions files:

  my $captions_file = ".captions";
  my $captions_filesep = qr/\s+----\s+/;

The defaults as issued are for photogallery style:

  my $captions_file = "captions.pg";
  my $captions_filesep = qr/:\s*/;

Formatting

Photogallery provides the following formatting options:

  # Set this to the standard width of the screen.  This will effect the
  # size of the thumbnail and large version of each image.
  my $screen_width = 600;

  # Set this to the number of columns in the thumbnail display.
  my $columns = 3;

  # Set this to the padding (in pixels) between columns
  my $padding = 10;

VERSION

0.9

AUTHOR

DeWitt Clinton <dewitt@unto.net> http://www.unto.net/

THANKS

Thanks to Fletcher T. Penney, whose ImageGallery plug-in provided much needed guidance (and a good number of code snippits).

Thanks to Chaz Hickman, who spotted (and corrected) a number of bugs and provided invaluable feedback on the documentation.

Igal .captions and some docs by Nick Leverton <nick@leverton.org> http://www.leverton.org/blosxom

SEE ALSO

Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/

Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html

TODO

The ability to define one by name (or one random or the first N where N >= 0) of the images for displaying on category or archive pages. Full gallery would be shown on the individual story pages. This would make sites with many big galleries much easier on the browser. Could be provided as a method or a parameter to make varying graphics heaviness easy to program.

Ability to define wanted image sizes more flexibly e.g. constrain all to fixed maximum frame size like igal xy and bigxy limits. Add other formatting methods or options nicked from igal (maybe read .igal.conf in gallery dirs). Even igal film strips ? ... maybe not, how many would prefer better styling options all round ? Introducing CSS classes as a start on this, look into making it .igal.css compatible.

Cache image dimensions so that we can send all image width and heights - helps browsers format faster. In fact this could well be a blosxom API function "serve up img with cached size and details".

Enhance to handle any image extension or mime type - default to image/* (mogrify should make it easy, leave it up to browser to render).

Show icon or representative frame from videos, as a basic media gallery.

CGI-ise properly with view to turning into method based interface for 4.0.

Merge into pixom for EXIF support.

Fix the Security Consideration (and avoid delays to browsers) by taking cached image generation out of the active thread.

SECURITY

Due to the writable directory there is a risk that an attacker who can compromise your web server via other means would be able to modify the cached images, perhaps even replacing them with malware, so you should ensure your system is fully secured.

It is important in any case that $image_dir is outside the normal webserver directories and not shared with other web server software, as it must be readable and writable during image cache generation and you do not want an attacker to have access to your normal web server files.

BUGS

Numerous, no doubt.

LICENSE

Blosxom Copyright 2003, Rael Dornfest

photogallery Copyright 2004, DeWitt Clinton, portions Nick Leverton 2007

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.