Simple static photo gallery that groups images by year and person. Demo
index.html— the web UI that readsphotos.jsonand displays the gallery.createjson.js— Node.js script to generatephotos.jsonfrom a folder tree of photos.
createjson.js scans a root folder that contains subfolders named by year (for example 2020, 2021) and builds a photos.json file. index.html loads that JSON to render a browsable gallery.
Requirements: Node.js (v14+ recommended).
Examples:
# Default: embed images as base64 in the JSON
node createjson.js --root "C:\path\to\photos-root" --out photos.json
# Embed image data
node createjson.js --root "C:\path\to\photos-root" --out photos.json --embed
# Produce a compact JSON (no pretty formatting)
node createjson.js --root "C:\path\to\photos-root" --out photos.json --compact--root/-r: root folder containing year subfolders.--out/-o: output JSON file path.--embed/-e: embed images as base64 urls.--compact/-c: write compact JSON.
The script also tries to extract person names from filenames (e.g. maria_dad.jpg → ['Maria','Dad']). If no names are found it uses Unknown.
- Opening
index.htmldirectly may work in some browsers, but a simple static server is recommended. - You may replace
json = await fetch('photos.json').then(r=>r.json());in your html to include your image data in your html. - This project does NOT provide encryption, authentication, or password protection. If you serve it on a public server or share the files, anyone who can access the server or the JSON can view the images.