Here at Burfield we produce a lot of WordPress websites and host them on our powerful Cloud servers. Our servers are pretty big and have very large hard drives, but we still need to keep a careful eye on storage to avoid spiralling costs and ensure our hosting packages remain competitive.
Out of the box WordPress itself doesn’t take up much disk space, but it comes with a powerful Media Library which allows users to upload images to be displayed on the front of the website. If like us, you host of lot of media-rich websites, the size of each install can very quickly increase in size as images uploaded by clients are uploaded and then processed to the various dimensions required for Responsive design.
This is particularly true if the upload limits on your server allow your clients to upload large files to the Media Library. Consider that a modern SLR camera can produce images of several Megabytes and you can quickly see how uploading a number of such images could quickly occupy a fair amount of disk space.
Backups out of control
At Burfield, we recently noticed one of our server’s backup partitions becoming inordinately large.
At this point it’s important to consider that at any one time we always maintain a 5 day disaster recovery backup of all the sites on our servers. We also take a weekly and monthly backup.
Whilst this is great for providing our clients (and us!) with peace-of-mind, it also means that we have to store multiple copies of all our sites (and all their associated media files) in our server’s backup partition. Even though these copies are compressed for storage, this still adds up to a considerable amount of storage overhead.
A quick analysis revealed that due to our relaxed file upload limits, several of our clients had been uploading extremely large images to their websites. This had been causing our backups to get increasingly large so we needed to find a solution that would
- Reduce the size of the uploaded files on the disk
- Stop clients from uploading unnecessarily large images whilst retaining the ability to upload larger files of other forms of media (eg: PDFs)
Luckily for us this other people have already run into this problem and there exist two excellent Plugins which can quickly help to resolve the issue.
How to Reduce (existing) WordPress Media Library File Size
To reduce the size of the original uploaded files we’ve utilised the Imsanity Plugin. This runs over your WordPress uploads directory and reduces the size of any excessively large source images to a reasonable setting which you define. Obviously, it needs to be used with caution, but for us, a single application saw a 5Gb site reduced to 1Gb in a single stroke. Not bad!
How to Stop WordPress Users Uploading Excessively Large Images
The process of stopping these excessively large source images being uploaded in the first place is equally simple using the WP Image Size Limit Plugin. Activating the Plugin allows administrators to set an upper upload size limit on image-based Media whilst preserving the ability to upload large files for other types of Media such as PDFs or videos.
Applying these two Plugins across all our sites has drastically reduced the size of our backup partition. Moreover by limiting the size of future uploads we’ve taken steps to prevent this becoming an issue again in the future.
We hope that you find this article useful.
Thanks to Rob McAvoy for the photo.