For quite some I wanted to write a small static image gallery so I can share my pictures with friends and family. Of course there are a gazillion tools like this, but, well, sometimes I just want to roll my own.
I took the opportunity during our stay in Schwaz to take a few hours and hack together snig, the (small | static | simple | stupid | ...) image gallery. Here you can see the example gallery (showing some of the pictures I took in Schwaz).
I used the old, well tested technique I call brain coding, where you start with an empty vim buffer and type some code (Perl, HTML, CSS) until you're happy with the result. It helps to think a bit (aka use your brain) during this process.
According to my timetracker I spend 8h 15min (probably half of it spend fiddling with CSS...).
Installation
I used the new Perl class feature, so you'll need at least Perl 5.40 which was released last year and is included in current Debian.
I prefer cpm to install CPAN modules:
cpm install -g SnigI haven't provided a Containerfile yet, but if somebody is interested, drop me a line.
You can get the raw source code from Source Hut (as I don't want to support the big LLM vacuum machines formerly known as Git(Hub|Lab)).
Example usage
You need a folder filled with images (eg some-pictures) and some place where you can host a folder and a bunch of HTML files.
ls -la some-pictures/ 7156 -rw------- 1 domm domm 7322112 Oct 6 09:14 P1370198.JPG 7188 -rw------- 1 domm domm 7354880 Oct 6 09:14 P1370208.JPG 7204 -rw------- 1 domm domm 7369728 Oct 6 09:14 P1370257.JPGThen you do
snig.pl --input some-pictures --output /var/web/my-server-net/gallery/2025-10-some-pictures --name "Some nice pictures"This will:
- find all jpgs in the folder some-pictures
- copy them into the output folder
- generate a thumbnail (for use in the list)
- generate a preview (for use in the detail page)
- generate a HTML overview page
- generate a HTML detail page for each image, linked to the next/prev image
- generate a zip archive of the images
- EXIF rotation hints are used to properly orient the previews
- images are sorted by the EXIF timestamp (per default, you could also use mtime)
You can then take the output folder and rsync it onto a static file server. Or install snig on your web server and do the conversion there..
Again, take a look at the example gallery.
Limitations
For now, snig is very simple and stupid, so quite a few things are still hard coded (like copyright and license). If somebody else wants to use it, I will add some more command line flags and/or a config file. But for now this is not needed, so I did not add it.
Have fun
I had quite some fun hacking snig and also used it as an opportunity to learn the new class syntax (and fresh up on subroutine / method signatures). So not only did I use my brain, I actually learned something new!
Please feel free to give snig a try. Or just use one of the countless other static image gallery generators. Or just write your own!
lobste.rs, hacker news, "reddit": https://www.reddit.com/r/perl/comments/1nzls1e/i_brain_coded_a_static_image_gallery_in_a_few/
.png)
