"Elementary Masonry Lightbox" photo gallery.
Go to file
dece cbe0446382 focus on JSON generation
EMLG does not generate the HTML file anymore, users are invited to copy
the provided index.html and use it as they see fit.
2022-09-04 18:26:20 +02:00
emlg focus on JSON generation 2022-09-04 18:26:20 +02:00
.gitignore focus on JSON generation 2022-09-04 18:26:20 +02:00
gallery-gen.go init 2022-05-17 18:43:32 +02:00
index.html focus on JSON generation 2022-09-04 18:26:20 +02:00
pyproject.toml init 2022-05-17 18:43:32 +02:00
README.md focus on JSON generation 2022-09-04 18:26:20 +02:00
setup.cfg focus on JSON generation 2022-09-04 18:26:20 +02:00

EmlGallery

EmlGallery (elementary Masonry & Lightbox Gallery) is a simple generator for Web galleries, based on Masonry, a library that beautifully tiles images on a page, and Lightbox, a library for presenting individual images nicely.

The Go source is a prototype I did a few years ago and kept here because it's fun to me that I used Go at some point!

License WTFPLv2.

Usage

Point the script to a folder with photos and it generates a JSON file with metadata, push it alongside your photos to a Web host and you are ready to go.

$ emlg "/home/dece/Photos/2022 dubious trip to antartica"
# "Data JSON saved."
$ ls $!
# → data.json  IMG1.jpg  IMG2.jpg  IMG3.jpg  …

The index.html file at the root of this repository is able to load the JSON data and build the gallery when someone visits your page. There are two ways to provide the JSON data to the gallery, explained below but also at the bottom of index.html itself.

First method: provide data.json as an URL

Host the HTML file somewhere and link it with the URL to your data.json as the fragment part of the URL (anything after the #).

Example: http://gallery.dece.space/#http://unrelated.host/

This method lets you host only one copy of the gallery page and provide different links for each gallery. One drawback is that the server hosting your images must have its CORS policy configured to let your browser load the photos.

Second method: embed data.json into the page

Override some variables as explained in index.html and you should be good to go. This method avoids the second request, but as you need to fetch the thumbnails anyway…