-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): resize images to max-size used in website (#2725)
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
1 parent
ded6390
commit 4df831f
Showing
9 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |