As mentioned in a previous post we visited a Sinterklaas celebration where we took a lot of pictures. The problem was that putting them on-line using NanoBlogger was a bit cumbersome. After some investigation on the NanoBlogger Yahoo group I found that a man named Chris had written a picture gallery plugin. After contacting him about it, he was so kind as to make it available to me. As it was still in a somewhat rudimentary state and I really like to tinker, I started writing my own plugin.

It is now in a quite usable state so I am sharing this with the rest of the world. Its usage is (hopefully) quite simple:

Usage

  1. Install the plugin gallery.sh in the NanoBlogger plugin directory. The plugin can be downloaded here.
  2. Create a directory named galleries in the NanoBlogger image directory. Any sub-directory of galleries will be considered a gallery.
  3. Place the pictures (JPG or PNG format) in the sub-directory of galleries that you created.
  4. Adjust the template main_index.htm to include the variable $NB_GalleryLinks
  5. Run nb -u all.

The created gallery will get the title of the sub-directory in which the pictures are stored.

These are the basics. But the plugin also gives the possibility to:

  • Prepend an introductory text
  • Annotate arbitrary pictures

Prepend introductory text

Create a file named intro.txt in the place the pictures are stored using nb --draft intro.txt and treat it like you would treat a regular entry for NanoBlogger. The title you set in the entry will be the title for the gallery.

Annotate pictures

Create a file named annotations.txt and put a line for each picture you want annotated using the following format:

<picture file>,<annotation>

Picture file is the local file name of the picture. Do not include paths, just use the bare file name. Everything after the comma is then considered an annotation for the picture.

To make the gallery a bit more pleasant-looking adjust your website’s style sheet. You can use this as an example.