2007-12-31: Minor release with feature enhancements. More...
2007-09-08: Small bug fix release. More...
2007-06-29: Some bug fixes and one small feature enhancement. More...
Plugin name: | File/GalleryHandler (File/DefaultHandler) |
---|---|
Author: | Thomas Leitner <t_leitner@gmx.at> |
Summary: | Handles images gallery files |
Parameters: | galleryPageTemplate: "gallery_gallery.template" imagePageTemplate: "gallery_image.template" images: "images/**/*.jpg" imagesPerPage: 20 mainPageTemplate: "gallery_main.template" |
Handled paths: | **/*.gallery |
This file handler uses image gallery files to automatically build image galleries. These image galleries are highly configurable and theme-able through the use of different gallery styles – have a look at the examples section!
An image gallery consists of three types of page files:
All these pages are created automatically by the gallery handler, but they don’t have any content; everything is done by the templates of a gallery style. The parameters imagePageTemplate, galleryPageTemplate and mainPageTemplate define which templates should be used for image pages, gallery pages and the main page. The default values can be overwritten in the gallery file!
Gallery styles are used… to style image galleries A gallery style consists of templates and, optionally, plugins. A minimal gallery style consists of the following files:
gallery_image.template
gallery_gallery.template
gallery_main.template
To display all available gallery styles use the following command:
$ wegben help use gallery_style
To use a specific gallery style called STYLE issue the following command:
$ wegben use gallery_style STYLE
This copies all normal gallery style files from the gallery style to the source directory and all plugins to the plugin directory, maybe overwritting files (you are asked before copying if you would like to procede). However, this command is not able to delete previously copied gallery style files, so you have to remove them yourself.
For information about how a gallery style can be created have a look at extending webgen section!
A gallery file has YAML as file format and is easy to create. It consists of two sections which are separated by a line consisting only of three dashes: the configuration section and the image section.
The first section of a gallery file is the configuration section in which you define the basic properties of your image gallery like the title or how many images should be displayed per page. By using the name of a gallery handler parameter as key you can override its value. Additionally the following keys are used by the gallery handler:
GalleryLayouter/<layouter-name>
For more information about the last two items have a look at File/ThumbnailWriter!
Two nearly always specified parameters should also be mentioned here: imagesPerPage and images. The first specifies how many images should be placed on a single gallery page. The second one specifies which images should be used the whole image gallery. These images have to be somewhere in the website source directory! You can/should not specify images outside the source directory as these images are not automatically copied to the output directory and automatic thumbnail creation may not work correctly!
If you want to create a multi-lingual gallery, you need to create two gallery files which specify
the same filename
key and different lang
keys. It’s best to first create one gallery file, fill
in all the information and then copy it and change the filename
and lang
keys as well as all the
other language specific information like titles and descriptions.
All other key-value pairs specified are not used by webgen. However, as layouter plugins have access to the whole configuration section they may use their own configuration keys.
The second section is the image data section in which additional data can be set for images. It has the image file paths as keys. These paths have to be relative to the gallery file! The following keys are used and/or set by the gallery handler:
gem install exifr
The gallery handler is able to automatically create thumbnails for the images in the image gallery
if the File/ThumbnailWriter is available. If so, the thumbnailSize
and
thumbnailResizeMethod
keys described above are used to create the thumbnail.
If the plugin is not available, you either have to explicitly specify a thumbnail via the
thumbnail
key for an image or the width
and height
attributes of the HTML img
tag are used
to scale the full image to the thumbnail size.
The following example gallery file shows the most common used configuration options:
title: Example Gallery imagesPerPage: 32 images: example/**/*.jpg mainPageMetaInfo: inMenu: false otherKey: value galleryPagesMetaInfo: orderInfo: 10 inMenu: true --- example/dir1/img1.jpg: title: Test title description: Long description of image example/img2.jpg: title: Title2 of pic mykey: mydata
First the title of the gallery is set and the imagesPerPage parameter
value is overridden. Then it is specified that all files with the extension jpg
under the
directory example
should be used for this image gallery.
The next two keys set the meta information for the main page and the gallery pages. Be aware that
the orderInfo
meta information is set for the gallery pages. This implies that the gallery handler
automatically increments the orderInfo
value for each gallery page sothat they are sorted and
displayed in the menu correctly.
The second section sets the meta information for the images of the gallery. All meta information set for the images will be available to the image template.