I have a WordPress multisite that I use for testing that contains 38 theme demos with over 30k images and over 9 gigs. As I looked for a way to easily compress these images and save some space on my server I realized that the plugins I checked were not going to be free for thirty thousand images and I would have to install the plugin on each site and run it thirty-eight times, so this didn’t seem practical. I found an easier way and thought that I would explain the steps so anyone could follow along.
First I downloaded all of the images from my site through my cPanel, this is quite easy, go to your cPanel and look for the File Manger
and navigate to your WordPress install and then the uploads directory /wp-content/uploads/ here you will find your directories with the years, if you are using the WordPress setting: WordPress ▸ Settings ▸ Media ▸ Organize my uploads into month- and year-based folders, these directories hold the images for your base site if you are using a multisite, or all of your images if it’s a single site install. You will also see a directory /sites/ for the rest of the images for your multisite.
You can use the cPanel file manager compress option to create a zip file with these directories once you have selected the directories.
Then download the zip file to your computer and extract it with your built-in option or 7-zip. Then download the free program Caesium Image Compressor and install it. Then you can open the directory on your computer that you extracted your images to and it may take a couple of minutes for it to import all of the images if you have over 30k like I did.
I chose to set the image quality to 40 and to not resize the images and to keep the folder structure and to save to a new directory.
It only took about 15 minutes to compress the 30K and gave a little report at the end showing that I saved 91% 8.73 gigs, from 9.59 gigs, I feel that is amazing.
I zipped the images into a new file and uploaded them to my site in the cPanel, and then deleted the current directories and extracted zip file, when I checked the sites I couldn’t see any difference in the images, they all looked great.
I hope you find this helpful, if you did please leave a comment below and let me know.
I hope you find this helpful, if you did please leave a comment below and let me know.