joppuyo / acf-image-aspect-ratio-crop

Image Aspect Ratio Crop field for Advanced Custom Fields
https://wordpress.org/plugins/acf-image-aspect-ratio-crop/
GNU General Public License v2.0
106 stars 16 forks source link

Clean Media Library #55

Open worldoptimizer opened 3 years ago

worldoptimizer commented 3 years ago

Hello, is there a way to purge the media library of unused crops. Meaning if I recrop multiple times I get all the variations linked to my post but I want only to keep the one currently linked? Is there a hook to enable this already?

joppuyo commented 3 years ago

Hey, there is a option to delete unused images but it's still in beta. It doesn't work really well with Gutenberg blocks and Polylang / WPML so I can't really recommend using it yet. I will have some time to figure out how to implement the functionality better after I have refactored the plugin.

kraftner commented 3 years ago

Could you go a little bit more into detail on what doesn't work well with blocks?

Your plugin is really great, the bloating of the media library is the only thing that worries me a bit. So if I can be of any help I'd be interested in how I might do so.

Kiitos!

joppuyo commented 2 years ago

Hey, a quick update on this feature.

I'm working on version 7.0.0 of the plugin right now. This will be a partial rewrite of the plugin so it has a more modular structure. This will make it easier to develop new features and enhancements. This version will initially drop support for the beta option to "delete unused images", since it doesn't work with images stored in Gutenberg blocks, a feature introduced in ACF 5.8.

I'm planning to re-introduce the feature in 7.1.0 after making sure it works correctly with ACF blocks and other relevant plugins. I'm planning to first create a manual tool that will scan every post, taxonomy, option page, etc. for images that are not in use and then allow you to delete them in one click. After this is done, I will most probably introduce a feature that allows you to automatically run this process, for example every week.

I apologize for leaving this feature only half-working for a really long time. I promise I will do better in the future and only introduce features that are ready and guaranteed to work correctly. It's just that building a feature that will delete data from users' sites is always really risky since any bug may result in potential data loss. It doesn't help there are so many different places where ACF fields can be added which adds to the complexity of this feature.

The current way the plugin works does introduce a lot of redundant data and I hope I will be able to deliver a comprehensive feature to rectify this in a future version on the plugin 🙂