We are scaling our images from global assets using ?width=X&height=Y etc. The output of this is cached. How do I invalidate the cache when a new picture is added or overwritten in global assets?
Thank you in advance!
This isn't to do with the scaling, images are served with an Expires header value of 12 hours by default (https://world.episerver.com/documentation/developer-guides/CMS/configuration/Configuring-staticFile/).
You'll need a way of cache busting when editors replace an image, there are some more details and a link to an approach in this blog post.
Thansk for your response.
Im a colleague to Benjamin. Our problem is that the server caches the image url.
I tried to setup the CDN support project and it works fine with the image url in the beginning. The generated url look like this "/48e763/globalassets/test.jpg?width=1320", but when i replace the image in EPi the Image, we do not get a new generated url, so do to caches we are still loading the old/wrong image.
Do you have other ideas to fix this issue?
I just tested this in Alloy and it seemed to work as I'd expect.
The hash is based on the saved date of the content, so if you hit the URL again (like your /48e763/globalassets/test.jpg?width=1320 example), you'll see the old image. However, if you've used the image on a block or page you'll see that the URL updates and, therefore, so does the image.
Does that address your issue?
are you using ImageResizer?
We are using ImageProcessor.Web v. 22.214.171.124