• Resolved Kenya

    (@bijee)


    Will this delete the sizes that are not needed when you do a regenerate thumbnails action? I have a lot of different sizes for each image in my uploads folder and I am not sure if they are all needed.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor viper007bond

    (@viper007bond)

    Currently it does not because posts could contain references to those old sizes.

    However I am in the process of rewriting the plugin from scratch and it will offer both the ability to delete thumbnail sizes that are no longer registered as well as updating the content of posts to use the updated sizes so that you shouldn’t have any broken images.

    If you want to prune those images, I would avoid using the plugin until the new version (3.0.0) because the new version determines what files to delete using stuff in the database that is currently overwritten during regeneration. This is because it’s not 100% safe to just delete based on filename. For example, is filename-100x100.jpg really a thumbnail or is it the original filename of an upload?

    Hope that answers your question!

    Thread Starter Kenya

    (@bijee)

    That does, but can you suggest a way to clean up all the extra images in the database? I have several folders of uploads and am trying to figure out how clean it up a bit. Also is there an ETA on 3.0.0?

    Plugin Contributor viper007bond

    (@viper007bond)

    The only thing related to thumbnails in the database is the original image’s filename and a list of thumbnail filenames that should exist. Nothing really to clean up.

    When you upload an image, thumbnails are made in all of the registered sizes. If you change existing thumbnail sizes or add/remove new named sizes, that’s where this plugin comes into play. v3 will let you delete thumbnail files for named sizes and dimensions that are no longer registered.

    No ETA yet for v3, but I’m actively working on it. There’s just a lot to do. ??

    • This reply was modified 7 years, 1 month ago by viper007bond.
    betagoo

    (@betagoo)

    You can add do_action before regenerate thumbnails.

    For example, I have 4 images:
    image-1024×768.jpg
    image-150×150.jpg
    image-300×300.jpg
    image-600×600.jpg – This is not defined image size. Image is created using aq_resize (aqua resizer) plugin.

    I need remove this image from disk before regenerate thumbnails.

    Into action I need to know the name of main file and path to this file. I know, the additional files names always end with -600×600. I can get the name of main image file, and add string -600×600 to filename.

    To unlink file I need two variables, path and filename.

    Can You apply this solution to Yous plugin?

    Plugin Contributor viper007bond

    (@viper007bond)

    There’s existing hooks you can use inside of the core functions, but I’ve since thought of a safe way to delete all old sizes without risking deleting non-thumbnails that are named like thumbnails.

    MDC2957

    (@mdc2957)

    Thread Starter Kenya

    (@bijee)

    @mdc2957 Thank you! I am intrigued. I will have to check this out.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Deletion of unused sizes’ is closed to new replies.