image-optimization.sh
@@ -7,4 +7,11 @@ cd /path/to/your/image/folder | |||
7 | 7 | find . -iname "*.jp*" -print0 | xargs -0 jpegoptim --strip-all -m76 | |
8 | 8 | # PNG optimization | |
9 | 9 | cd /path/to/your/image/folder | |
10 | - | find . -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve | |
10 | + | find . -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve | |
11 | + | ||
12 | + | # from: https://ayrn.io/bulk-optimize-jpg-png-images-ubuntu/ | |
13 | + | # from: https://gist.github.com/VirtuBox/e00d67ed177aa0d5af0edf2d087ef43c | |
14 | + | ||
15 | + | # AAPanel | |
16 | + | find /www/wwwroot/*/wp-content/uploads -name "*.jpg" -exec jpegoptim --all-progressive --strip-all '{}' \; | |
17 | + | find /www/wwwroot/*/wp-content/uploads -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve |
image-optimization.sh(檔案已創建)
@@ -0,0 +1,10 @@ | |||
1 | + | # from: https://gist.github.com/w33zy/7b948d10175f5417af60ce0128e1e1bd | |
2 | + | # Install jpegoptim and optipng | |
3 | + | apt update && apt install jpegoptim optipng -y | |
4 | + | ||
5 | + | # JPG optimization | |
6 | + | cd /path/to/your/image/folder | |
7 | + | find . -iname "*.jp*" -print0 | xargs -0 jpegoptim --strip-all -m76 | |
8 | + | # PNG optimization | |
9 | + | cd /path/to/your/image/folder | |
10 | + | find . -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve |
上一頁
下一頁