fgallery example
Created by Steven Baltakatei Sandoval on 2023-07-07T01:40+00 under a CC BY-SA 4.0 (🅭🅯🄎4.0) license and last updated on 2023-07-07T03:41+00.
Summary
I wanted to test out a static HTML+Javascript photo gallery package I found on Debian to answer a question on a Lemmy thread about self-hosted photo galleries. The end result was this example gallery.
Setup procedure
On a Debian 11 system, the following commands may be used to create an
fgallery image gallery.
Install fgallery
$ sudo apt update;
$ sudo apt install fgallery;
Install optional tools
$ sudo apt install jpegoptim pngcrush 7zip;
Build a gallery from photos in photo-src/.
#!/bin/bash
din=./photo-src ;
dout=./test4 ;
title="Tanabata at Portland Japanese Gardens, July 2022 - Steven Baltakatei Sandoval";
fgallery -c txt -s -j4 --index="https://reboil.com/mediawiki/2022-07-07" \
"$din" "$dout" \
"$title" && \
python3 -m http.server -d "$dout";
The input directory path is set in din, the output directory path is
set in dout.
The title of the webUI page is set in title.
The -c txt option tells fgallery to look for captions for an image
in a text file named exactly the same as the image file except that
the final extension (e.g. .jpg of photo-src/foo.jpg) is replaced
with .txt (e.g. photo-src/foo.txt).
The -s option prevents the original image files from being included
as an archive in the output and disables downloading of such an
archive.
The -j4 option specifies that up to 4 image processing jobs may be
performed in parallel in order to speed up creation of the output
directory contents if at least 4 CPUs are available.
The --index option specifies the URL for the "Back" button at the
top left of the gallery webUI.
The && specifies the next command python3 should only run if the
fgallery command does not fail.
The \ at the end of some lines tells bash to ignore the newline
(so longer commands in the script are broken up to be more readable).
The python3 -m http.server -d "$dout" command creates a simple local
HTTP server at the address http://localhost:8000 so a web browser
can view the webUI without there being a need to upload anything to
any remote server.
