Created
November 13, 2016 00:34
-
-
Save m1m1s1ku/c662106ee09d56314ae937c24f5ca7a0 to your computer and use it in GitHub Desktop.
Optimize jpg/png using PHP/Exec
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
<?php | |
exec("find /var/www/FOLDER/img/ -type f -name '*.jpg' -exec jpegoptim --strip-all {} \;"); | |
exec("find /var/www/FOLDER/img/ -type f -name '*.JPG' -exec jpegoptim --strip-all {} \;"); // Sometimes, .jpg are.. .JPG | |
exec("find /var/www/FOLDER/img/ -type f -name '*.png' -exec optipng -o2 {} \;"); // Level 2, change to -o2 => -o7 | |
mail('mail@mail.com', 'Server', 'Jpg/Png opti done'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment