If you’re maintaining a WordPress installation with loads of images, disk space and bandwidth are probably a big issue. If they’re not, they will be soon. And if that site is hosted on a shared account, your hosting company probably already proved to you that something called “unlimited” does not exist.

OK, now when we know that, what can we do?

  • We have to start (if we’re not already doing) optimizing our images,
  • We have to optimize our existing collection, the best we can,
  • We have to think about getting a better host, or offloading images off our existing host.

Obviously, we won’t upload huge images, but even our optimized JPEGs or PNGs can be optimized even further. Meet Yahoo’s excellent Exceptional Performance series that recommends several ways to optimize your images in a lossless way. What’s even more better, there’s already a plugin called WP Smush.it that brings this functionality to WordPress, so we can use it easily. It automatically optimizes your images on upload, and it offers a bulk optimization feature for all the images that are already there. The feature is still experimental, and using it on a large amount of images proves to be a problem. More about this later on.

Better host is a hard thing to define. No shared host will offer you a truly “unlimited” option, so you can forget about that. They will offer to charge the extra bandwidth on a monthly basis though, but you have to decide if this is the best option. Getting dedicated servers is probably not an option, for obvious $$$ reasons. What I find a good option is to offload images to a CDN (Content Delivery Network) network. Amazon Simple Storage Service (S3) first come to mind, and in my calculations, this option proves to be x2 cheaper then paying for additional bandwidth.

WP Smush.it

The plugin is great, make no mistake about that. However, the problem is the bulk feature, that appears to be a memory hog. Basically, on one of my installations that had around 6k images, using it was not possible, since I would always get “out of memory” errors. Since I’m on a shared host, allocating more memory is not an option. Luckily, there are two ways around this:

  • Use AJAX Thumbnail Rebuild plugin along with WP Smush.it. AJAX Thumbnail Rebuild plugin uses AJAX to rebuild one image at a time, and since WP Smush.it is already active, it optimizes each one.
  • Hack a bit into the WP Smush.it code, and limit it to a certain number of images, for example, 500 (thus avoiding the “out of memory” error). Then run the bulk feature enough times to cover all your images.