Support » Plugin: Autoremove Attachments » Does the job.

  • Seems to work!

    • This topic was modified 2 years, 2 months ago by  Doug.
    • This topic was modified 2 years, 2 months ago by  Doug.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    I’m sorry to hear about your problem, Doug. But from what you’re describing it sounds like you’re using another script / plugin that generates images on the fly or one that doesn’t use standard WordPress practices when it comes to manipulating images.

    The cleanup process of this plugin uses native WordPress functions and by doing so it removes everything when the conditions are met: the attachment entry from the database, the original image and all thumbnails that were generated from it.

    I find it very hard to believe your problem is caused by this plugin but I’m willing to investigate further. What other plugins are you using for image handling? Do you have any other plugins for optimizing your database? ( plugins that remove autosaves, revisions, etc… )

    Best regards,
    Eusebiu Oprinoiu

    Understood, changed to 5 stars.
    I also use “EWWW Image Optimizer”. Could this be a conflict between the 2? It never did anything like that before.

    Plugin Contributor Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    Thank you, Doug! It means a lot.
    I’m not aware of conflicts with EWWWW Image Optimizer but I’m going to investigate this in depth.
    In the meantime can you tell me if your theme uses any kind of script for generating images on the fly? Aqua Resizer, BFI Thumb and TimThumb are the most popular ones.
    Have yo tried any other plugins in the past that changed the default behavior for your images? ( plugins like Optimize Images Resizing, Imsanity, Regenerate Thumbnails, etc ) Or maybe a plugin that does direct SQL queries on your database for cleanup purposes like WP-Optimize.

    No problem. i did it in a moment of madness and you didn’t deserve it. It was a mistake to do that. Thank god i was able to take it back.

    As for the questions:
    -The theme is “Newsmag” by tagdiv i don’t think they use anything like “timthumb”. It just register sizes and generates thumbnails thru wordpress.

    -I might have used them all at some point. Right now i only have EWWW (it does resize to a max size like imsanity + optimize + convert png-> jpg)

    -I have also used wp-optimie and similar before.

    But when Autoremove Attachments was active only EWWW was active.

    Plugin Contributor Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    That’s ok. I wasn’t offended. I actually felt bad thinking my plugin broke your website. Either way, I’m going to investigate further and regardless of what I’ll find I’m going to release an update with a few extra security checks in place. ( for those edge-case scenarios when other plugins do things improperly )

    There is only one scenario when you might end up with missing images, but that’s documented in the FAQ and I’m hoping you are aware of it: When you attach an image to a specific post that image becomes the child of that post. If you insert that image or a thumbnail generated from it in another post and at a later time you delete the original post (the parent), you will end up with missing images in the other places you used the image. Unfortunately, there is no way around this behavior due to the way WordPress handles images. That’s why if you plan on using an image in multiple places you should upload it from Media > Add New. This way the image won’t be attached to any post and you won’t have any restrictions.

    As for your theme, I’m fairly certain it uses some sort of script for generating images on the fly. The markup is very different than the one generated by WordPress. There is no sign of the responsive markup, the image classes are different and the “alt” tag is always the title of the post. ( I’m looking at this theme: http://eusb.me/2heFOuj )
    If I’m right you have a serious problem. All those custom sizes generated on the fly will become orphan files on your server with no way of removing them through your dashboard. Even if you delete the files from your media library those custom sizes will remain on your server because they are not recognized by WordPress. You will have to remove them by hand, through FTP.
    Even if the script does a proper cleanup (which I doubt it does), the removal of those thumbnails will stop working the moment you switch to another theme.

    Anyway, I’m going to do some extensive testing tomorrow and I’m going to let you know if I find anything.

    Best regards,
    Eusebiu Oprinoiu

    Plugin Contributor Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    As promised, I did a lot of testing today and the plugin worked as expected in all scenarios.
    My guess is you mistakenly used images attached to specific posts across multiple posts. As a consequence, when you removed the original parent post ( and with it all its child attachments ) you ended up with missing images in every other place.

    Combine this with the fact your theme uses a third party script to generate images on the fly ( that are not tracked by WordPress ) and now you can explain why there were orphan thumbnails left on your server. Obviously, this is just a theory… If you want to know for sure you should do some testing. Here are some steps to get you started:
    – Disable Autoremove Attachments ( to make sure it doesn’t interfere )
    – Create a new post
    – Upload a new image in your media library
    – Set this image as the featured image of your post
    – Load this new post on the frontend to trigger the generation of the custom thumbnail ( generated on demand by your theme )
    – Load any other archive page that might generate other custom sizes ( the index page, the category page, etc )
    – Check on your server what thumbnails are available
    – Delete the image from your media library
    – Check on your server again to see if there are any orphan thumbnails left

    I hope this helps you find the root of your problem.
    Regardless, I’m releasing an update later today with extra security checks and a one-time onboarding process for new users.

    Best regards,
    Eusebiu Oprinoiu

    Thank you i’m installing the plugin again, i’ll let you know if i run into problems again.

    Edit: OK i installed and activated the latest version but it doesn’t work for me now at all.
    I had a post in the trash i installed the plugin and i emptied the trash. The images remained on the library now “unattached”. I thought it was a glitch because the post was in trash before i installed the plugin.

    So i create a test post uploaded a new image to the post and published it. Then i trashed the post and emptied the trash. the image remains on the library unattached. Dunno what’s up now, it worked before.

    • This reply was modified 2 years, 2 months ago by  Doug.
    • This reply was modified 2 years, 2 months ago by  Doug.
    Plugin Contributor Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    There is a small change in the latest version: After you install and activate the plugin for the first time an admin notice is displayed bringing to your attention the limitations of the plugin. Basically, it asks you to read carefully the FAQ section. If you accept the constraints presented there, press the “Accept Restrictions” button on that notice. The plugin no longer removes the attachments automatically until you click that button.

    This happens only for new installs of the plugin. Those who update from an earlier version are not affected by this change.

    I did click accept before removing the posts. Weird.

    Plugin Contributor Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    That’s strange. I just did another test and it works.
    Can you do another test after a fresh install of the plugin? ( Uninstall -> Reinstall -> Activate -> Accept ) If everything goes well, the notice should disappear and the automatic removal of your attachments should start working.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Does the job.’ is closed to new replies.