Image sizes in WordPress – .com

Today I dedicate a few minutes to clear up a basic but very repeated question in the emails I receive daily: What the hell does WordPress do with images?

It may seem like a trivial question, but it has a crumb, because strange as it may seem, when you upload an image to WordPress, it doesn’t just upload it, it does a couple of things.

1. Lower the image quality

You are right. It is a little known subject, but when you upload a .jpg image, WordPress reduces its quality by 10%, to optimize space and transfer. In principle, this is negligible, but in some cases, when the image is already highly optimized, and it is usually quite large, some details that indicate a lower image quality are usually appreciated.

Above all, it is appreciable if the photo has a very good resolution and is of a considerable size, occupying a large part of the screen, or even as a parallax or background of the web. If that is your case, you simply have to install the plugin that I created a couple of years ago and that’s it.

2. Automatically create 3 (or more) versions of the image

Once again, a detail that cannot be seen with the naked eye, until one day you are surprised by the large number of files in the media folder. It turns out that every time you upload an image through WordPress, it triples it, creating 3 more versions of different sizes.

By default these sizes are 150×150, 300×300 and 1024×1024, but we can easily modify that in Settings / Media, where we will see the following:

See also  AppGyver course #4. Composer Pro in depth - .com

Any change we make there will automatically modify the size of those images created by WordPress, so that the “thumbnail” size, the “Medium” size and the “Large” size will be the ones you indicate from that moment on. But beware that this change No it is retroactive. If you want the sizes of all the ones that were uploaded at the time to be modified, you will have to install and run the plugin. But… What is that for? Who wears those sizes? Why does WordPress create them?

The reason is simply for convenience. WordPress assumes that surely our theme (theme, template) will use the images in several places: As a featured image, a thumbnail in the list of posts, within the article, etc. And that is why it already creates 3 sizes a priori “just in case” the theme uses them.

But the truth is that on many occasions the theme has its own image sizes in mind, and far from using those three (who does not know what dimensions they are about) create your own. And sometimes some plugins even create as many, as is the case with WooCommerce, which create three more sizes for product images. So in the end we may end up with 6 or 8 new image file sizes every time we upload one.

Yes, you have understood it correctly. Let’s give a very clear example. In the image that you can see on the right, you can see 18 images in the “images” folder. Well, actually that comes only from going up a single image. The original is the latest “tutorial.bandanas.jpg”. The rest (the other 17) They have been generated by WordPress, the theme and the plugins that are installed on that website.

See also  WP-CLI Course #1. Introduction - .com

It’s easy to spot those autogenerated images because they all have the name of the original image, followed by a hyphen, and the size in pixels of width by height. So, the one with “tutorial.bandanas-300×225.jpg” will be one of those created by WordPress, as well as the one with 150 pixels and the one with 1024 pixels. The rest… who knows you! The theme creates some, WooCommerce others, and other plugins still others. So it would be time to investigate to see who is responsible for this multiplication of the loaves and fish.

Is there anything we can do about it? Well, there is a trick that will save us hard drive space. It turns out that WordPress only creates those images if the dimensions of the image we upload are greater than the ones we have indicated. In other words, this automatic process it only reduces images, but never “enlarges” them (because they would be pixelated). So if we set a size of 0 on all slides (miniature, medium and large)it will never create them, since no matter how small the image we upload is, it will never be less than zero.

I hope this article is useful to you and sheds some light on this question that so many people ask. You already know that if you want to know more and better about WordPress, you can subscribe to my , in which I talk about this and much more. You already know that if you do, you will be able to access .

Loading Facebook Comments ...
Loading Disqus Comments ...