Have you discovered an abundance of duplicate images in different sizes when browsing your website’s image folder? Assuming you didn’t create them, the duplicate images may have been created by your content management system (CMS).
WordPress, for instance, will automatically generate scaled copies of images. When you upload an image via the WordPress dashboard—either by using the media uploader tool or the GutenbergGutenberg is the name of a modern WordPress editor that was introduced with the release of WordPress 5.0 in De… More editor—it will create several copies of the image in different sizes: thumbnail, medium, large, etc.
While there’s no option to disable this feature in the CMS’s settings, you can stop WordPress from generating copies of images in a few ways.
Why WordPress Generates Copies of Images in Different Sizes
It may sound like a waste of storage space, but there’s a reason WordPress generates copies of images in different sizes: it simplifies the process of adding images to various parts of your website.
You can upload an image in its native size, after which you can select from one of the automatically generated sizes. With WordPress generating copies of the image in different sizes, you won’t have to manually resize it.
Your theme may also use the automatically generated sizes for various purposes. If you upload an image and set it as the featured image for a post, your site’s theme may use the thumbnail-sized copy of that image on your archive pagesIn WordPress, a page is a content type that is used to create non-dynamic pages on a website. Pages are typica… More. The thumbnail-sized copies will be smaller than the original featured imagesA featured image, also known as a post thumbnail, is an image that represents the contents of a WordPress post… More, allowing them to display properly on archive pages.
WordPress will typically generate the following copies for each uploaded image:
- Thumbnail (150×150 pixels)
- Medium (300×300 pixels)
- Large (1024×1024 pixels)
Reasons to Avoid This Feature
This default WordPress feature has some drawbacks.
For starters, it will consume storage space on your site’s server. Most web hosting companies don’t offer unlimited storage. Instead, they provide you with access to a limited amount of storage space, such as 60GB or 200GB. When WordPress generates image copies, it will store them on your site’s server, resulting in more space being consumed.
Creating backups will take longer if you allow WordPress to generate copies of images in different sizes. Creating a backup, of course, requires downloading all of your site’s files. With this WordPress feature, you’ll have to download four times as many images as you normally would. You’ll have to download all of your site’s original images and a set of three copies for each of them.
You may struggle to find specific images if you allow WordPress to generate copies of them. Neither the media uploader tool nor the Gutenberg editor will display the copies. File transfer protocol (FTP) clients, though, will display them. If you use an FTP client to browse your website’s image folder, you’ll have to sift through all of the copies to find specific images.
This feature can also cause problems with animated GIFs. If your website uses a lot of GIFs, you may want to stop WordPress from scaling them to ensure that they animate and loop properly.
How To Stop WordPress From Creating Scaled Copies Of Your Images (3 Methods)
Now that we’ve discussed why WordPress generates copies of your images, along with why may not want this to happen, let’s explore three simple methods that you can use to stop WordPress from scaling your images to different sizes.
1. Upload Images Outside of the Dashboard
Instead of using the WordPress dashboardIn WordPress, the Dashboard is a central hub for managing a website’s content and settings. It is the first sc… More, consider uploading images directly to your website using an external FTP client. An FTP client is a program or app that connects your computer to your site’s server. Using the FTP client’s interface, you can transfer files between these two devices.
Using an FTP client to upload images allows you to bypass the WordPress dashboard. WordPress will only generate copies of images if you upload them via the dashboard. With an FTP client, you can circumnavigate this feature to transfer images from your computer to your site’s server. You can then include the images in postsA post is a type of content in WordPress, a popular open-source content management system used for creating an… More and pages by linking to them.
Remember to avoid uploading the same images using the Gutenberg editor. If you’ve already uploaded an image using an FTP client, you can simply link to it from the Gutenberg editor. Uploading the image a second time in the Gutenberg editor will only force WordPress to generate copies of it.
2. Set Sizes to 0
While there’s no option to disable WordPress from generating copies of images in different sizes, an alternative workaround is to change their sizes. Setting the sizes of the image copies to 0 will stop WordPress from generating them.
To change the sizes of the thumbnail, medium and large images generated by WordPress, navigate to Settings > Media
using the main WordPress menuIn WordPress, a menu is a collection of links that are displayed as a navigation menu on a website. Menus are … More:
You should see height and width boxes for the three aforementioned formats. Change the values of these boxes to 0.
Of course, WordPress can’t generate images with a height and width of zero pixels. Therefore, setting the height and width of the thumbnail, medium and large images to 0 will stop WordPress from generating image copies.
3. Check Your Theme’s Code
You should check your theme’s code to see if it generates copies of images. From either the WordPress dashboard or an FTP client, open your theme’s functions.php file. All themesA WordPress theme is a set of files that determine the design and layout of a website. It controls everything … More have a functions.php file. This file is used to customize and enhance themes with new functionality.
After opening your theme’s functions.php file, use the search function to look for add_image_size
. You may find something like this:
add_image_size( 'post-thumbnail size', 800, 240 );
add_image_size( 'homepage-thumb size', 220, 180 );
add_image_size( 'fullpage-thumb size', 590, 9999 );
This snippet is used to generate copies of images in different sizes. It’s different, however, than the feature WordPress uses to generate image copies. Even if you set the sizes to image sizes to 0 in the dashboard, your theme may generate image copies independently.
To stop your theme from generating image copies, you’ll need to remove all instances of the add_image_size
snippet from its functions.php file.
Warning: Always create a backup before making changes to your theme files. It’s also a good idea to create a child theme to avoid having your changes overwritten by a future update.
Keep in mind that removing the add_image_size
snippet will likely affect your theme’s layout. Your theme won’t show the copied and resized images in the defined places. Therefore, you may need to further tweak your theme so that it offers a uniform and attractive layout.
Final Thoughts
WordPress isn’t without flaws. One of the most common complaints is that it generates scaled image copies. By default, WordPress will automatically generate three copies of each image—though your theme may define additional sizes as well.
The good news is that you stop WordPress from generating copies of images by using an FTP client to upload media, setting the sizes to 0, and/or tweaking your theme’s code.
If you have any questions about WordPress scaling images and generating image copies in different sizes, please feel free to leave a comment below!