20. March 2018 Note
I am trying to make my blog faster, so I wrote a code to optimize
*.jpg images with the
jpegoptim is one of a command line tool, so this code is using
Following picture was optimized from 235.18KB to 124.88KB.
- If you want to use this code, you have to install
jpegoptiminto your server and please change the path to
jpegoptimin this code.
- This code is optimizing only resized ( and edited?) images, so the full-size images won’t be optimized.
- If you run WP-CLI command
wp media generate, this code will be fired too.
- The jpeg quality is
60, so I guess you feel it is low. Please edit it if you need.
- I don’t want to be customizable the path to the
jpegoptimfor security reason, so I don’t publish this as a WordPress plugin. 🙂