Fighting Duplicate Images in WordPress

By default, every image uploaded into WordPress content folder has a number of duplicates, of different sizes. Additionally, some templates and plugins can also generate previews of the same images, some need them, others do it just in case. As a result, number of duplicates can exceed 5-10 images.

If your WordPress site has a great amount of photos or images, after a while you may have problems with the lack of disk space on the host (in case it’s not unlimited). In this article we’d like to show you how to prevent this nasty duplication.

Why Is it Bad to Have Duplicate Images?

Unlike page duplication image copies do not cause any particular harm to the site. They just take up more space on your hosting. Luckily for everyone most hosting providers give considerable storage for users. As a rule storage capacity starts from 1Gb and higher, for some blogs 1Gb is enough to keep great amount of optimized images. But sometimes this is not enough.

Additional image duplicates are generated while you upload any image. As a result, after being uploaded, the storage automatically duplicates the image but in a number of different sizes.

Just think about it, in any blog post we may load up to 10 or 20 images, if you’re not using optimized images, sooner or later (you will not even notice how this happens) disk space on your hosting quickly evaporates.

Duplicate images affect the size of a backup copy of your site in a few hundred Mb. If you create the backup copy of your site in the cloud storage, or you’re using some plugins, they have to work with a huge volume of information, that’s why there may appear some errors.

If you see that some image sizes are not used on your website, it’s advisable to switch off duplication of images of that specific size. So you will save some disk space on your hosting.

Where Do Those Duplicated Come From?

Before you start fighting duplicate imagees, you need to know how many copies are there generated from one of those uploaded images. By default, WordPress generates three images of different size (thumbnail size, medium and large size). Some templates can generate additional dimensions to create their thumbnails for sliders, or other functions.

To find out how many additional copies are there generated, log into your FTP-client and open the directory /wp-content/uploads/. Let’s have a look at a real-life example:

image duplicates

On this screenshot you can see that MonsterPost generates two duplicates of the same image in different sizes.

How to Get Rif of Those Duplicates?

Removing all those duplicates is not always reasonable. Even if you remove all those unwanted images, there is no guarantee that they will not appear again…sooner or later.

As for the WordPress engine, there are some settings that can prevent generation of unnecessary image sizes. To do this, go to the menu Settings >> Media. As shown in the image below, you need to reset all those sizes.

image sizes

So when you reset these figures you’ll be able to insert into the post images of the highlest size, later in the editor you can adjust the size by changing the width value.

image insert

By default, you may have other sizes. Therefore, when the image is loaded WordPress automatically generates it in different sizes. The larger size of the download, the more duplicates there will be. So, if you upload image of 600 by 600px, larger sized duplicates will not be generated. Consequently, the smaller the size of an upoaded image, the lesser amount of doubles there will be created.

* * *

I think that by now you have already visited your content folder and counted number of duplicates. Isn’t it time to get rid of them? Here is a powerful tool for you, an Image Cleanup WordPress plugin.

banner-772x250

This plugin does great amount of work with your images, like:

  • Saves your space taken up by unreferenced/backup images.
  • Fixes incorrect metadata (sizes).
  • Has a bulk repair/delete functionality.
  • Adds pagination for extremely large result sets.
  • Logs tabs easily visible for reviewing.
  • Shows detailed information in log tabs.
  • Has full restore functionality.

If you’re not using additional thumbnails you can disable this functionality in the template itself. Thus you will get rid of great amount of duplicates.

Just don’t forget to upload images that are optimized for web and try not to use built-in WordPress function for photo editing. Since it also creates duplicates and cramms your disc space. Just think about it, what will happen to your blog in five years, if you don’t get rif of those duplicates your content folder will turn into a real “image mess”.

2014.04.04Have a nice day.