Created
December 31, 2018 14:54
-
-
Save bend/7dd8cf42f78578ddaaf4f7426cad07b0 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# Purpose: batch image resizer | |
# Source: https://guides.wp-bullet.com | |
# Author: Mike | |
# absolute path to image folder | |
FOLDER="/var/www/wp-bullet.com/wp-content/uploads" | |
# max height | |
WIDTH=540 | |
# max width | |
HEIGHT=300 | |
#resize png or jpg to either height or width, keeps proportions using imagemagick | |
#find ${FOLDER} -iname '*.jpg' -o -iname '*.png' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \; | |
#resize png to either height or width, keeps proportions using imagemagick | |
#find ${FOLDER} -iname '*.png' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \; | |
#resize jpg only to either height or width, keeps proportions using imagemagick | |
find ${FOLDER} -iname '*.jpg' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \; | |
# alternative | |
#mogrify -path ${FOLDER} -resize ${WIDTH}x${HEIGHT}% *.png -verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment