Skip to content

Commit

Permalink
feat(website): resize images to max-size used in website (#2725)
Browse files Browse the repository at this point in the history
Add script `process_images.sh` that allows recompressing in the future if new organisms are added.

Implementing this recommendation from Google's PageSpeedInsights: https://pagespeed.web.dev/analysis/https-pathoplexus-org/gnxkqyl8t4?form_factor=mobile
  • Loading branch information
corneliusroemer authored Sep 9, 2024
1 parent ded6390 commit 4df831f
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 0 deletions.
Binary file added website/public/images/organisms/cchf.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/public/images/organisms/cchf_small.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/public/images/organisms/ebolasudan.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/public/images/organisms/ebolasudan_small.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/public/images/organisms/ebolazaire.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/public/images/organisms/ebolazaire_small.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/public/images/organisms/wnv.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/public/images/organisms/wnv_small.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions website/scripts/process_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Check if the correct number of arguments is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <image_directory>"
exit 1
fi

# Directory containing images
IMAGE_DIR="$1"

# Loop over all jpg files in the directory
for img in "$IMAGE_DIR"/*.jpg; do
# Extract the filename without extension
filename=$(basename "$img" .jpg)

# Skip files that already have '_small' in their filename
if [[ $filename != *"_small" ]]; then
# Resize, compress the JPEG and save it
magick "$img" -resize 200x\> -strip -quality 85 "$IMAGE_DIR/${filename}_small.jpg"
fi
done

0 comments on commit 4df831f

Please sign in to comment.