I added some automation to my gallery setup. I don’t mind the thought of hand-editing a YAML file, but if I move that work upstream, I can enforce a good Lightroom habit where it’s easier because the image is just sitting there – no concerns about typos or crossing image name with description. Over the long haul my library’s metadata will improve, and if I keep my Smugmug account it’ll benefit presentation there.
The manual part:
-
Pick your images in Lightroom
-
Make sure each of them has a “Caption” property in the metadata
-
Export them to JPEGs, making sure to preserve metadata at export.
-
Do whatever compression. I am using Squash because it is fast, easy, and good.
-
make a directory in
_galleries/#{gallery_name}
-
Copy the images into the directory
-
Make an index.md that looks something like:
--- title: "Office Day" layout: gallery description: "I took a Funleader 18 to the Puppet office's on a quiet day when few people were in." image: galleries/office-day/DSCF3262-2.jpg gallery: office-day ---
The automated part:
Run this ditty in the root of your Jekyll install using the target directory as an argument:
- If there’s a data file for that gallery, it reads it in.
- If there’s no data file, it makes a new hash
- Loops through jpegs in the directory.
- If the data for the current jpeg has a description, leave it alone
- if the data for the current jpeg has no description, use the caption from EXIF data
- Dumps the hash back out as YAML in the
_data/galleries/#{gallery-name}.yml
file
Things to consider:
- I think I could do the image minification with RMagick, but I don’t know how to get the same results I’m getting from Squash.
- Using keywords in Lightroom to introduce tags to galleries
- Automate the generation of
index.md
for each gallery.
But Mike, whyyyyyyy?
I poked around in Smugmug a few days ago and really did not enjoy it. It has gallery embeds, but they’re slideshows instead of the responsive “wall of tiles” look I’ve got going. It’s also just sort of slow and fussy and clicky. It’s a very nice product for people who sell their work, but I am not one of those people. It takes me about five minutes to prep a batch of photos for a Jekyll gallery, and the end result is portable: YAML data describing the contents of each directory.
Also, “because it’s fun.” More on that later.