croxton / imgixer

Generate Imgix URLs in Craft 3
MIT License
11 stars 4 forks source link

Any plans to add some image purging for Imgix? #13

Closed terryupton closed 10 months ago

terryupton commented 10 months ago

Hey Mark @croxton ,

Do you have any plans to bring imgix purging tot he plugin at all? It is the only one feature from ImagerX that I really miss. I think ImagerX handles this well, so it might be worth seeing how they do, but I think if an image is updated on the system purge is automatic, but if this isn't easy, perhaps just the ability to manually purge the asset through the cog/options in the CMS.

Screenshot 2023-11-23 at 13 50 43

Thanks Terry

croxton commented 10 months ago

Hey Terry, I'm not sure this plugin should - I want it to remain focussed on generating image transform URLs rather then interacting with APIs. Also, if I added purging for Imgix then I'd need to do so for Imagekit and any other service I might add in the future. It would create dependencies on third party APIs which are likely to change (i.e. technical debt).

Imgix say this about purging assets:

To absolutely ensure compliance for an updated asset, it is best to give the asset a new path by renaming the file. Purging an asset is only recommended when absolutely necessary.

I think that's the best approach as it would break the cache for any service. I usually ask my editors to do this, but there is a small plugin that does it for you - perhaps you could give it a try and report back?

https://plugins.craftcms.com/fingerprint-assets?craft4

terryupton commented 10 months ago

Hey Mark.

Thats understandable and I appreciate this would add additional overhead. I think the best way as you recommend is to ensure that the URL is updated to automatically purge the cache. I will remember this for the future also. I will also reach for that plugin if it becomes a larger concern.

Thanks. Terry

croxton commented 5 months ago

Just found out asset revving is built into Craft. Leaving this here for future reference: https://craftcms.com/docs/4.x/config/general.html#revasseturls

terryupton commented 4 months ago

Thanks @croxton - I have tried this, but it doesn't see to have an affect. I think because the source image is still passed to imgix without the ?v=1715331879 I might be doing something wrong, but have you tried it at all?

croxton commented 4 months ago

Thanks @croxton - I have tried this, but it doesn't see to have an affect. I think because the source image is still passed to imgix without the ?v=1715331879 I might be doing something wrong, but have you tried it at all?

Ah yes I remember now, it's a query string value and not a file rename. We would definitely need it to rename the file like the Fingerprint plugin linked above.