diff --git a/content/photography/2017-06-21-old-quebec.md b/content/photography/2017-06-21-old-quebec.md index 9f87135..11fe3be 100644 --- a/content/photography/2017-06-21-old-quebec.md +++ b/content/photography/2017-06-21-old-quebec.md @@ -2,7 +2,7 @@ title: Old Quebec date: 2017-06-21 extra: - cover_image: /photos/2017-06-21-old-quebec.jpeg + cover_image: /photos/2017-06-21-old-quebec.preview.jpeg --- ![Old Quebec](/photos/2017-06-21-old-quebec.jpeg) diff --git a/content/photography/2017-06-21-stormy-quebec-street.md b/content/photography/2017-06-21-stormy-quebec-street.md index 28548d6..f4690ee 100644 --- a/content/photography/2017-06-21-stormy-quebec-street.md +++ b/content/photography/2017-06-21-stormy-quebec-street.md @@ -2,7 +2,7 @@ title: Stormy Street in Quebec date: 2017-06-21 extra: - cover_image: /photos/2017-06-21-stormy-quebec-street.jpeg + cover_image: /photos/2017-06-21-stormy-quebec-street.preview.jpeg --- ![Stormy Street in Quebec](/photos/2017-06-21-stormy-quebec-street.jpeg) diff --git a/content/photography/2017-06-22-montmorency-falls.md b/content/photography/2017-06-22-montmorency-falls.md index bcea356..9369336 100644 --- a/content/photography/2017-06-22-montmorency-falls.md +++ b/content/photography/2017-06-22-montmorency-falls.md @@ -2,7 +2,7 @@ title: Montmorency Falls date: 2017-06-22 extra: - cover_image: /photos/2017-06-22-montmorency-falls.jpeg + cover_image: /photos/2017-06-22-montmorency-falls.preview.jpeg --- ![Montmorency Falls](/photos/2017-06-22-montmorency-falls.jpeg) diff --git a/content/photography/2017-08-04-rocky-shore-halifax.md b/content/photography/2017-08-04-rocky-shore-halifax.md index 44ac389..e147efd 100644 --- a/content/photography/2017-08-04-rocky-shore-halifax.md +++ b/content/photography/2017-08-04-rocky-shore-halifax.md @@ -2,7 +2,7 @@ title: Rocky Shore date: 2017-08-04 extra: - cover_image: /photos/2017-08-04-rocky-shore-halifax.jpeg + cover_image: /photos/2017-08-04-rocky-shore-halifax.preview.jpeg --- ![Rocky Shore](/photos/2017-08-04-rocky-shore-halifax.jpeg) diff --git a/content/photography/2019-08-04-halifax-port.md b/content/photography/2019-08-04-halifax-port.md index 4b57bb0..796cd0d 100644 --- a/content/photography/2019-08-04-halifax-port.md +++ b/content/photography/2019-08-04-halifax-port.md @@ -2,7 +2,7 @@ title: Halifax Port date: 2019-08-04 extra: - cover_image: /photos/2019-08-04-halifax-port.jpeg + cover_image: /photos/2019-08-04-halifax-port.preview.jpeg --- ![Halifax Port](/photos/2019-08-04-halifax-port.jpeg) diff --git a/content/photography/2019-08-09-jacobs-ladder.md b/content/photography/2019-08-09-jacobs-ladder.md index f53ab62..df2b668 100644 --- a/content/photography/2019-08-09-jacobs-ladder.md +++ b/content/photography/2019-08-09-jacobs-ladder.md @@ -2,7 +2,7 @@ title: Jacob's Ladder date: 2019-08-09 extra: - cover_image: /photos/2019-08-09-jacobs-ladder.jpeg + cover_image: /photos/2019-08-09-jacobs-ladder.preview.jpeg --- ![Jacob's Ladder](/photos/2019-08-09-jacobs-ladder.jpeg) diff --git a/content/photography/2020-07-19-my-desk.md b/content/photography/2020-07-19-my-desk.md index 4a8389e..a9e5c56 100644 --- a/content/photography/2020-07-19-my-desk.md +++ b/content/photography/2020-07-19-my-desk.md @@ -2,7 +2,7 @@ title: My Desk date: 2020-07-19 extra: - cover_image: /photos/2020-07-19-my-desk.png + cover_image: /photos/2020-07-19-my-desk.preview.png --- -![My Desk](/photos/2020-07-19-my-desk.png) \ No newline at end of file +![My Desk](/photos/2020-07-19-my-desk.png) diff --git a/content/photography/2020-07-23-two-cars.md b/content/photography/2020-07-23-two-cars.md index ae453b5..543705e 100644 --- a/content/photography/2020-07-23-two-cars.md +++ b/content/photography/2020-07-23-two-cars.md @@ -2,7 +2,7 @@ title: Two Cars date: 2020-07-23 extra: - cover_image: /photos/2020-07-23-two-cars.png + cover_image: /photos/2020-07-23-two-cars.preview.png --- ![Two Cars](/photos/2020-07-23-two-cars.png) diff --git a/content/photography/2022-01-18-snow-day-in-space.md b/content/photography/2022-01-18-snow-day-in-space.md index 1d28fd7..0d21be3 100644 --- a/content/photography/2022-01-18-snow-day-in-space.md +++ b/content/photography/2022-01-18-snow-day-in-space.md @@ -2,7 +2,7 @@ title: Snow Day in Space date: 2022-01-18 extra: - cover_image: /photos/2022-01-18-snow-day-in-space.jpg + cover_image: /photos/2022-01-18-snow-day-in-space.preview.jpg --- ![Snow Day in Space](/photos/2022-01-18-snow-day-in-space.jpg) diff --git a/static/photos/2017-06-21-old-quebec.preview.jpeg b/static/photos/2017-06-21-old-quebec.preview.jpeg new file mode 100644 index 0000000..c8f42ed Binary files /dev/null and b/static/photos/2017-06-21-old-quebec.preview.jpeg differ diff --git a/static/photos/2017-06-21-stormy-quebec-street.preview.jpeg b/static/photos/2017-06-21-stormy-quebec-street.preview.jpeg new file mode 100644 index 0000000..a44a8c2 Binary files /dev/null and b/static/photos/2017-06-21-stormy-quebec-street.preview.jpeg differ diff --git a/static/photos/2017-06-22-montmorency-falls.preview.jpeg b/static/photos/2017-06-22-montmorency-falls.preview.jpeg new file mode 100644 index 0000000..e172d74 Binary files /dev/null and b/static/photos/2017-06-22-montmorency-falls.preview.jpeg differ diff --git a/static/photos/2017-08-04-rocky-shore-halifax.preview.jpeg b/static/photos/2017-08-04-rocky-shore-halifax.preview.jpeg new file mode 100644 index 0000000..45afbf0 Binary files /dev/null and b/static/photos/2017-08-04-rocky-shore-halifax.preview.jpeg differ diff --git a/static/photos/2019-08-04-halifax-port.preview.jpeg b/static/photos/2019-08-04-halifax-port.preview.jpeg new file mode 100644 index 0000000..44c8943 Binary files /dev/null and b/static/photos/2019-08-04-halifax-port.preview.jpeg differ diff --git a/static/photos/2019-08-09-jacobs-ladder.preview.jpeg b/static/photos/2019-08-09-jacobs-ladder.preview.jpeg new file mode 100644 index 0000000..c0d7a5e Binary files /dev/null and b/static/photos/2019-08-09-jacobs-ladder.preview.jpeg differ diff --git a/static/photos/2020-07-19-my-desk.preview.png b/static/photos/2020-07-19-my-desk.preview.png new file mode 100644 index 0000000..effe1ce Binary files /dev/null and b/static/photos/2020-07-19-my-desk.preview.png differ diff --git a/static/photos/2020-07-23-two-cars.preview.png b/static/photos/2020-07-23-two-cars.preview.png new file mode 100644 index 0000000..5819948 Binary files /dev/null and b/static/photos/2020-07-23-two-cars.preview.png differ diff --git a/static/photos/2022-01-18-snow-day-in-space.preview.jpg b/static/photos/2022-01-18-snow-day-in-space.preview.jpg new file mode 100644 index 0000000..8115ad5 Binary files /dev/null and b/static/photos/2022-01-18-snow-day-in-space.preview.jpg differ diff --git a/static/photos/generate_previews.sh b/static/photos/generate_previews.sh new file mode 100644 index 0000000..f8ddc71 --- /dev/null +++ b/static/photos/generate_previews.sh @@ -0,0 +1,45 @@ +#! /bin/bash +set -ex + +# Check if ImageMagick is installed +if ! command -v convert &> /dev/null; then + echo "ImageMagick is not installed. Please install it before running this script." + exit 1 +fi + + +# Get the directory of this script +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +# Find all images with extension ".png", ".jpg", or ".jpeg" +# NOTE: Ignore any image containing ".preview." in the name +IMAGES=$(find $DIR -type f -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" | grep -v ".preview.") + +# Loop through all images +for IMAGE in $IMAGES; do + # Create the preview file name (file.preview.ext) + PREVIEW="${IMAGE%.*}.preview.${IMAGE##*.}" + + # If the file already exists, skip it + if [ -f "$PREVIEW" ]; then + echo "Preview already exists for: $IMAGE" + continue + fi + + # Check if the image is bigger than 1440x1440 + WIDTH=$(identify -format "%w" $IMAGE) + HEIGHT=$(identify -format "%h" $IMAGE) + + if [ $WIDTH -gt 1440 ] || [ $HEIGHT -gt 1440 ]; then + # Create the preview. This should be a 2 fifths resolution version of the original image + convert $IMAGE -resize 40% $PREVIEW + elif [ $WIDTH -gt 720 ] || [ $HEIGHT -gt 720 ]; then + # Create the preview. This should be a half resolution version of the original image + convert $IMAGE -resize 50% $PREVIEW + else + # Create the preview. This should be the original image + cp $IMAGE $PREVIEW + fi + + echo "Created preview for: $IMAGE" +done \ No newline at end of file diff --git a/templates/photo-timeline.html b/templates/photo-timeline.html index 27d8c46..53ac767 100644 --- a/templates/photo-timeline.html +++ b/templates/photo-timeline.html @@ -16,6 +16,7 @@
+
{% endif %} {% endfor %}