Support » Plugin: ImageMeta » Find and batch delete ‘orphan’ image files?

  • Resolved intelligentdb

    (@intelligentdb)


    Short question: Can we use your ImageMeta plug-in to identify and safely batch delete ‘orphan’ image files in the WordPress library?

    Longer explanation:

    1. I am a developer specializing in the FileMaker platform and have used various RESTful APIs, including most recently for WooCommerce.
    I am not a web developer or WordPress developer, though I am working with the WP developer on this project.

    2. I have everything in our FileMaker-to-WooCommerce API integration working great (creating/updating Categories and Products). We were about to move to the production site when we started running out of storage space.

    I discovered that every time I send a product update that includes the list of image urls from our local server, WooCommerce does not simply replace previously uploaded images with the new images, but keeps adding to the WordPress library. Note that of course not all updates include the ‘images’ data, but if someone wants to add or remove or rearrange the order of images for a product, the WooCommerce API only allows the option to re-send and re-upload the complete list, rather than perhaps an ‘add/drop/reorder’ instruction.

    I can manually search the WordPress Media Library and see that there may be dozens of redundant image files for a single product. They all appear to be attached to a product, but there’s no way for me to tell which are the ones that the product is currently attached to. Via the WooCommerce API, I can obtain the ID of the image, but the API does not have a ‘Delete Image’ function (!).

    3. I have done some cursory searching and it appears from various posts that
    a. others are confounded by the same issue.
    b. this is normal WordPress behavior
    c. one might use the WordPress API to delete images. I’m not about to start from ground zero and learn/integrate that API as well at this point.

    We need a quick fix to reliably perform occasional maintenance, removing these ‘orphan’ image files, even if initiated manually. We don’t have a high volume of image re-uploading (this problem was only discovered when we ran out of space while performing some stress testing with high volumes). Nonetheless, we can’t keep collecting and storing orphan image files.

    Your thoughts, suggestions are greatly appreciated.
    Stay safe.
    — Sincerely, Erik

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ERA404

    (@era404)

    Hello Erik.

    I wouldn’t recommend it.
    The plugin simply detects embeds and attachments to posts and pages.
    WooCommerce likely uses custom database fields and objects, and ImageMeta doesn’t know to check in those places to determine use/disuse.

    Thread Starter intelligentdb

    (@intelligentdb)

    Thank you. That was our conclusion when trying it out just now. Good for manually deleting one image at a time, maybe, and even then there’s no way to search for them; only browse the list of 1,000s
    Cheers.

    Plugin Author ERA404

    (@era404)

    Hello @intelligentdb

    If you find a solution, please be sure to post it here, in the event others are looking for a similar tool.

    ERA404

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Find and batch delete ‘orphan’ image files?’ is closed to new replies.