Support » Fixing WordPress » Media files created by WordPress: Why so many?

  • Hedley

    (@hedley)


    It used to be (I think) that WordPress only created three media files upon an image upload: Small, Medium, and Large.

    These days, it seems to have gone crazy, creating as many as nine, depending on the original image size. Here’s what I find on my fileserver when I upload an image today (test-image.jpg, 1920×1173):

    test-image.jpg
    test-image-1568×958.jpg
    test-image-1536×938.jpg
    test-image-1024×626.jpg *
    test-image-768×469.jpg
    test-image-300×183.jpg *
    test-image-150.150.jpg *

    Only the ones marked with an asterisk are defined on the media settings page. The others aren’t being generated by another plugin – I did this on a fresh site with no installed plugins and only the Twenty Twenty-One theme activated.

    It wouldn’t be so bad if there was actually a way to use the extra images, but I see no way to use them directly from within WordPress, except by hard-coding a file URL. Most of these never get used and are just hogging up resources on my fileserver.

    So what’s the point? Are these being generated for some future automated responsiveness functionality?

Viewing 4 replies - 1 through 4 (of 4 total)
  • mrtom414

    (@mrtom414)

    The theme is responsible for creating images sizes. It does it with the following function add_image_size. It up to the theme developer how many sizes generated. If the dimensions are not correct the function will crop the image which might come out badly.

    • This reply was modified 4 months ago by mrtom414.
    • This reply was modified 4 months ago by mrtom414.
    threadi

    (@threadi)

    I think there is already an open ticket here for what you mean, which is being processed by the core developers: https://core.trac.wordpress.org/ticket/55290

    By the way, it makes sense to increase the number of generated images. In the meantime, only responsive websites are created that also require responsive image output. For this purpose, image files adapted to the required sizes are usually used. WordPress generates some quite common sizes for this by default. Of course, many themes adapt this to their own conditions.

    Thread Starter Hedley

    (@hedley)

    Thanks for these responses. I guess Twenty Twenty-one is creating the extras.

    It seems to me that increased numbers of images *can* make sense, if they are used/usable, but I’m not convinced that’s the case – I’m not seeing much evidence, in looking at source code of pages, that these *are* being used, and obviously I have no option to selectively use them at will, since within WordPress admin there’s no way of knowing that they even exist.

    And do I really benefit from having both “test-image-1568×958.jpg” and “test-image-1536×938.jpg”?

    Obviously I’m just going to have to live with this, though, unless I want to develop my own themes. I guess I can always use a plugin to delete all unattached images from my server, if I feel that inode usage is getting out of control.

    H.

    threadi

    (@threadi)

    Another hint:
    If a theme comes with certain defaults and you then change to another theme, it may be that some generated images are no longer needed. Here, for example, this plugin can help to regenerate only the currently configured dimensions: https://wordpress.org/plugins/regenerate-thumbnails/

    Most themes try to make image generation as simple as possible for the user. They specify dimensions that are used by the theme for responsive output. If you are a user, you have to rely on this or you should ask the respective theme producer (in the case of TwentyTwentyOne here: https://wordpress.org/support/theme/twentytwentyone/). If you are a developer, you could adapt these defaults if necessary.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.