Compress WordPress Media Images On Mac OS X Without A Plugin

0

If you’ve had a WordPress site for a while, chances are your media library is filled with images. Here’s a quick project (requiring FTP, SSH, and Mac OS X) which can considerably help optimize your images without using a plugin. This will translate to faster page loads and decreased bandwidth consumption.

wordpressDownload and install ImageOptim. If you want to preserve EXIF data (shutter speed, exposure, focal length, etc), make sure to uncheck “Strip JPEG metadata” in the preferences.

SSH into your server and run the following two commands:

cd public_html/wp-content/
zip -r uploads.zip uploads/

This will create a zip file called uploads.zip in your /wp-content/ folder. Using FTP, download this file to your desktop and unzip the file. Copy and paste the unzipped “uploads” folder into ImageOptim and wait. The application will automatically perform lossless compression and write over the original files. Depending on the size of your media library, this can take quite some time.

Now re-zip the uploads folder and upload it back via FTP to the /wp-content/ folder. SSH back into your server and run the following:

cd public_html/wp-content/
rm -r uploads/
unzip uploads.zip/

Using FTP, browse your file structure and make sure all your zipped images ended up in the same places under the “uploads” folder as before. All done. 🙂

 LEAVE A REPLY

Please enter your comment!
Please enter your name here