WordPress.org

Ideas

delete unused image sizes

  1. Joona Nuutinen
    Member

    Yes, please. This would be a fantastic feature.

    Posted: 1 year ago #
  2. swvc
    Member

    Oh please. Some years later and I have the same problem!

    Posted: 1 year ago #
  3. Ipstenu (Mika Epstein)
    Lead Plugin Wrangler

    Detecting if an image size is truly unused is harder than it looks.

    Are you 100% sure you never used a size in a post? Because if you did, and you delete it, you broke your post.

    Posted: 1 year ago #
  4. swvc
    Member

    OK...it's difficult. I kinda get that and yes, I already have a missing image in one of my posts (I deleted about 20 versions of one image through cPanel to see what would happen, leaving the size I thought the embedded image was and getting the sizing wrong - another attempt with a different image worked). But I can't even download a zipped copy of my site to use in Desktopserver because it is so bloated with unused images in all sorts of sizes. And deleting my many images this way will take weeks.
    As a novice, I went through several iterations in developing the site as I learned more and, like life in general, I now have baggage. What about DNUI (https://apps.nicearma.com/product/dnui-delete-not-used-image-pro/)? But I'm afraid to try it as I use Envira Gallery and I bet it conflicts in some way my tiny brain cannot foresee. Any suggestions or positive advice out there? http://www.coppinger.blog

    Posted: 1 year ago #
  5. Ipstenu (Mika Epstein)
    Lead Plugin Wrangler

    By default, WP makes no more than 4 sizes of an image: Small, medium, large, and the original.

    Themes and plugins can use add_image_size() to add in more sizes. The catch in all this is to make sure you're only uploading what you MUST upload.

    To keep my generated images down to 8, I look at what sizes the theme uses:

    add_image_size( 'home-bottom', 150, 150, TRUE );
    add_image_size( 'home-middle', 332, 190, TRUE );
    add_image_size( 'home-top', 960, 400, TRUE );

    the ones my plugin(s) use:

    add_image_size( 'character-img', 150, 200, true );
    add_image_size( 'show-img', 960, 400, true );

    And then I make sure that media settings matches a couple of them

    * Thumbnail: 150x150
    * Medium: 332x332
    * Large: 1024x1024

    This greatly reduces the potential images (and yes, I know having show-img and home-top the same is silly, it's a long story).

    Now in addition, I keep track of what image sizes need to be what. Like show-img shows on 'show' pages. Since I know the 'featured image' for shows needs to be 960x400, I make that my image size when I upload. It then WILL NOT make a 1024 image size, and I end up with six image sizes.

    The character size being 150x200, I try to only upload that size. Again, keeps my numbers down to around three 'copies' of an image.

    But the thing is, I actually make sure I'm using the sizes.

    But I can't even download a zipped copy of my site to use in Desktopserver because it is so bloated with unused images in all sorts of sizes.

    How big are we talking? I regularly sync up my 6G site which has 38k images

    Posted: 1 year ago #
  6. atiemerin
    Inactive

    Good information. Thanks admins

    Posted: 1 year ago #
  7. swvc
    Member

    Agre, all good information. But my issue is that my past sins are coming back to haunt me. Because I and the site have evolved in a disjointed way as I became the one-eyed man in the kingdom of the blind, I have created and used plugins and different galleries as I have experimented. The experiments are gone and many of the plugins, but many image files remain. For instance, I have 12 copies of some images, in all sorts of different sizes. I can see that I could go through deleting each unused size by hand but it might produce a psychosis over time. Atrtbees suggested I delete all my image files and then ran a plugin called 'Regen Thumbnails'. That didn't go so well. I restored my site and then rang regen thumbnails again but ????

    I found a plugin called DNUI (Delete not used images) PRO, that sounded just the ticket. But when I ran it (I am a sucker for punishment), nothing happened. Nada. I have messaged the developer but have not heard back. So, I will assiduously follow the advice about limiting the number of different sizes of image that WP creates in the future but what to do for my 10Gig site!! Especially as I live in rural New Zealand and have a data cap.

    Posted: 1 year ago #
  8. Rafa GT
    Inactive

    Have you checked this?

    https://wordpress.org/plugins/optimize-images-resizing/

    Posted: 1 year ago #
  9. swvc
    Member

    Hi Rafta GT,

    Thanks for that. I tried a plugin called DNUI but (possibly because I use Envira Galleries) it deleted a bunch of images in use. I'm going to try this one - I'm always game for a laugh and bit of full restore!

    Steve

    Posted: 1 year ago #
  10. peripatetic
    Inactive

    Going to vote for this one, as I'm currently trying to clean up 13Gb of images!

    @Mika, if you're still there, where does one find the add_image_size values for a theme and WordPress's default settings?

    Posted: 1 year ago #

RSS feed for this topic

Reply »

You must log in to post.

  • Rating

    12345
    39 Votes
  • Status

    Sorry, not right now