OFFLINE-GmbH / oc-responsive-images-plugin

Adds reponsive images capabilities to October CMS
MIT License
45 stars 26 forks source link

Update Clear.php #102

Closed PubliAlex closed 1 year ago

PubliAlex commented 1 year ago

Hello,

I noticed during some tests that the clear image widget don't correctly clear all temporary images.

It was because the commande looked at images prefixed with thumb_, don't know if it changed recently with the latest version of october, but images generated with responsive images are not prefixed like that.

To provide a more robust solution, this change look at the image extension responsive image parse (by reading settings) and delete all files that have that extension.

tobias-kuendig commented 1 year ago

Thank you for this addition. This could delete more than just the thumbs generated by the plugin, but since it only looks at the storage/temp folder I guess this is a safe way to go since all files in there are onyl temporary by design.

PubliAlex commented 1 year ago

@tobias-kuendig Yes, I thought about that and I had the same conclusion, if the clear image widget finally clear all images, not only the ones generated by the responsive resize, it's pretty good, nobody want to have several clear images widget depending on the module that generate them.