Description

A thumbnail gallery library for spiffy

Author

Peter Bex

Version

Requires

Download

phoghorn-eggdoc.egg

Documentation

Phoghorn is a web-based image gallery with built-in automatic thumbnail generator for spiffy the webserver.

Its features are:

Use

By default, phoghorn assumes there is a directory called galleries in the directory from which you call its functions (ie, the same directory in which you placed index.ssp). It will create thumbnails on-the-fly when there aren't any yet, and only for those pictures on the page that is currently being viewed. By default, these will be placed in the thumbs directory under the gallery's directory.

In the main page (save this as index.ssp):

<?scheme (use phoghorn) ?>
<html>
<head>
<title>Phoghorn example</title>
</head>
<body>
<?scheme
(parameterize ((ph:movie-image "/pics/movie.jpg")) ; Default is #f
  (ph:show-gallery))
?>
</body>
</html>

In the zoomed-in page (save this as zoomed.ssp):

<?scheme (use phoghorn) ?>
<html>
<head>
<!-- The current photo's filename is the title -->
<title><? (ph:get-entry) ?></title>
</head>
<body>
<?scheme
(parameterize ((ph:movie-image "/pics/movie.jpg")) ; Default is #f
  (ph:show-zoomed-entry))
?>
</body>
</html>

Note that currently there's no support for calling phoghorn from SXML pages. This is an important shortcoming and the intention is to rewrite the output functions to SXML for the next release.

Configuration

Phoghorn can be customised to the max. The following SRFI parameters are supported:

Directory and file settings
parameter: (ph:gallery-dir) [default: "galleries"]
The directory under which the galleries can be found, relative to the index page.
parameter: (ph:index-page) [default: "index.ssp"]
The main webpage serving the Phoghorn script. This shows the image thumbnails.
parameter: (ph:zoomed-page) [default: "zoomed.ssp"]
The webpage that serves the zoomed-in views on images.
parameter: (ph:thumb-dir) [default: "thumbs"]
The name of the directory under which thumnail versions of the images in the parent directory are stored.
Thumbnail generation
parameter: (ph:thumb-max-width/height) [default: 100]
Maximum width or height of a thumbnail.The smaller of the two will get scaled by the same factor as the larger, which will be shrunk into this size. In other words, it maintains the aspect ratio of the original picture in the thumb.
Presentational options
parameter: (ph:entries/page) [default: 25]
The number of pictures to display on one page.
parameter: (ph:table-width) [default: 5]
The number of images horizontally (to be deprecated).
parameter: (ph:prev-page-text) [default: "prev"]
The text on the link to the previous page.
parameter: (ph:next-page-text) [default: "next"]
The text on the link to the next page.
parameter: (ph:up-link-text) [default: "up"]
The text on the link to a higher directory.
parameter: (ph:prev-entry-text) [default: "prev"]
The text on the link to the previous image in zoomed view.
parameter: (ph:next-entry-text) [default: "next"]
The text on the link to the next image in zoomed view.
parameter: (ph:unzoom-link-text) [default: "back"]
The text on the link to the gallery view (displayed inzoomed view).
parameter: (ph:movie-image) [default: #f]
The image file to display when a movie is in the gallery. This image will also be displayed in the zoomed view, as a link to the actual video clip.
parameter: (ph:root-gallery-name) [default: "Gallery list"]
The title of the topmost gallery. All subgalleries have a title that is equal to the directory name.

Output document structure

The output can most easily be looked at in the source view of your favorite browser, but to style it with CSS it is handy to have a reference. There is an example CSS file in the examples section.

Global

All phoghorn output is wrapped in a div element of class phoghorn. It also has class gallery when in thumbnail view, and class zoomed in zoomed view.

The zoomed view

Links above and below the image are inside a div of class navigation. The image itself is inside a div of class entry.

The gallery/thumbnail view

The list of subgalleries, if present, is inside a div of class gallerytree. The list itself is an ul. The list item of the link to the parent gallery, if present, has class uplink.

Below the subgalleries list (and repeated again below the gallery) is a div of class navigation. This navigation has the links to the other pages. The current page number is not a link, but a span of class curpage.

The gallery itself is inside a table, containing the thumbnails.

Examples

/*
 * All stuff Phoghorn outputs is centered, and in a sans-serif font of a
 *  decent size.  Any stuff above or below the Phoghorn output is separately
 *  on a new line.
 */
div.phoghorn {
	text-align: center;
	font-family: arial, tahoma, verdana, helvetica;
	font-size: 12px;
	clear: both;
}

/* A blue background for the thumbnails */
div.phoghorn table {
	background-color: #6688bb;
}

/* Current page in thumbnail view shown in red */
div.phoghorn .curpage {
	color: red;
}

/* We show the gallery tree in a table-like fashion */
div.phoghorn .gallerytree {
	display: block;
	text-align: center;
	width: 100%;
}

div.phoghorn .gallerytree li {
	/* background-color: #cc0000; */
	display: block;			/* Remove leading list-bullets */
	width: 200px;			/* Link text is left-aligned inside */
	text-align: left;		/*   the 200 pixels-wide `li' element */
	float: left;			/* Don't make them start a new line */
	padding-bottom: 10px;		/* Leave room between them vertically */
}

div.phoghorn .gallerytree li.uplink {
	width: 100%;			/* The uplink is on its own line */
	text-align: center;		/* Centered */
}

/* Start the table on its own line, not to the right of the navigation */
div.phoghorn table {
	clear: left;
}

License

Copyright (c) 2005 - 2006, Peter Bex (peter.bex@xs4all.nl)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. Neither the name of author nor the names of any contributors may
   be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.