🦃 NTHP_ 🏈

Adding Photos

Web, Hugo

Just for fun, I added a photos section.

Pics PLS


I have a couple of cameras, not including my phone. So I have a fair amount of photos, and I wanted to share those. I’ve used services in the past made for this. Flickr, PixelFed. But those never felt all that personal. So I made my own.

If you head over to /photos, you’ll see some photos of mine. Clicking on one will take you a page with the photo, and some of the camera data.

I’m using a bash script I wrote to fill in the info. Running the script will first create a post id, then open that folder for me to plop the photo in. I have an export preset in Lightroom Classic that limits the size, and adds a water mark. The script will then rename the file, make a tiny version for the main page, and fill in the camera info.

#!/bin/bash

id=$(date | md5sum | head -c 10)

hugo new content photos/$id/index.md

echo "Opening dir"
echo "Place photo in dir, then press return to continue"
echo "Only .jpeg are supported"
open content/photos/$id
read cont

cd content/photos/$id

mv *.jpg tmp.jpeg
mv *.jpeg fig.jpeg

convert fig.jpeg -resize 800x800\> figs.jpeg

rmloc

echo "<pre>" >> index.md

printf "$(exiftool -Model fig.jpeg)" >> index.md
echo "" >> index.md

printf "$(exiftool -LensModel fig.jpeg)" >> index.md
echo "" >> index.md

printf "$(exiftool -FocalLength fig.jpeg)" >> index.md
echo "" >> index.md

printf "$(exiftool -ISO fig.jpeg)" >> index.md
echo "" >> index.md

printf "$(exiftool -ApertureValue fig.jpeg)" >> index.md
echo "" >> index.md

printf "$(exiftool -ShutterSpeedValue fig.jpeg)" >> index.md
echo "" >> index.md

echo "</pre>" >> index.md

cd ../..

exit

I also added an RSS feed for it.

I’ll be adding some more photos to it. My Lightroom Classic catalog is around 50GB, so I have plenty to choose from.

–Update–

I ended up moving to having Hugo make the EXIF data table, instead on the bash script. The script is still the same, but I ripped all of the exiftool commands out. Here’s a gist of the Hugo partial.


Reply via email

Latest Post
Previous | Random Post | Next
Subscribe via RSS
RSS users get bonus content*