Created
May 11, 2021 04:18
-
-
Save tuanhaviet22/829cae381c959fd9f46c3b8ec7d46953 to your computer and use it in GitHub Desktop.
Useful command optimize image
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
#Use two package jpegotpim & optipng to optimize image | |
aptitude install jpegoptim optipng | |
find . -type f -regex ".*\.jpe?g" -exec jpegoptim --strip-all {} \; | |
find . -type f -name "*.png" -exec optipng {} \; |
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
#Bash file for cron | |
#Create current path | |
DIR=$PWD"/public/" | |
find $DIR -type f -regex ".*\.jpe?g" -ctime -1 -exec jpegoptim --max=90 --strip-all {} \; | |
find $DIR -type f -name "*.png" -ctime -1 -exec optipng -o5 {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment