Caching images from assets

Vote:
 

Hello

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!

Regards,

Benjamin

#200278
Jan 08, 2019 12:29
Vote:
 

Hi Benjamin,

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.

#200321
Edited, Jan 09, 2019 0:12
Nalin - Mar 29, 2021 2:10
Hi Jake,
I am new to Epi Server and we are facing exact issue what you are mentioned in that blog post(jondjones). Just curious about the code changes/integration, that we have to do with that EPiServer.CdnSupport code. Could you please guide us how to do that? Even example code would be highly appreciated.

Thanks in advance
Vote:
 

Hi Jake, 

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?

#200542
Jan 15, 2019 13:46
Vote:
 

Hi Jonathan,

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?

#200546
Jan 15, 2019 16:39
Vote:
 

are you using ImageResizer?

#200554
Jan 15, 2019 17:09
Vote:
 

We are using ImageProcessor.Web v. 4.9.3.25

#200669
Jan 21, 2019 7:47
Toke Frostholm - Nov 06, 2019 12:59
Did you find a solution to the problem using ImageProcessor? I am having the same issue.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.