Skip to content

Instantly share code, notes, and snippets.

@konratnox
Created August 19, 2019 08:32
Show Gist options
  • Save konratnox/302d5afad5833f6526984cefacfb7a50 to your computer and use it in GitHub Desktop.
Save konratnox/302d5afad5833f6526984cefacfb7a50 to your computer and use it in GitHub Desktop.
BOPTI=`du -L -s ${SITEDIR} | awk '{print $1}'`
find -L ${SITEDIR} -type f -iname '*.jpg' \
-exec jpegoptim -q --strip-all {} \; \
-exec chown ${SITEUSER}:www-data {} \; \
-exec chmod 664 {} \;
find -L ${SITEDIR} -type f -iname '*.png' \
-exec optipng -quiet -clobber -fix -strip all {} \; \
-exec chown ${SITEUSER}:www-data {} \; \
-exec chmod 664 {} \;
#find -LE ${SITEDIR} -type f -iregex '.*\.(jpg|png)$' \
#-exec jpegoptim -q --strip-all {} \; \
#-exec optipng -quiet -clobber -fix -o7 -strip all {} \; \
#-exec chown ${SITEUSER}:www-data {} \; \
#-exec chmod 775 {} \;
AOPTI=`du -L -s ${SITEDIR} | awk '{print $1}'`
echo -n "Saved "
echo -n "$((BOPTI-AOPTI))"
echo " Kb"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment