tjoskar / ng-lazyload-image

🖼 A small library for lazy loading images for Angular apps with zero dependencies
https://naughty-bose-ec1cfc.netlify.com
MIT License
763 stars 142 forks source link

Image not refreshing with same URL with updated image #553

Open dhaneshgosai opened 2 years ago

dhaneshgosai commented 2 years ago

I got one wired issue on Lazyload library.

It's working fine with the image URL and its loading image and caching it.

But when a new image is replaced with an old one on the same URL, it does not fetch a new one from the same URL and only shows the old one from cache.

How can I refresh my cache with new image data?

Code which I am using right now:

<img class="disti-img" [defaultImage]="defaultImage" [lazyLoad]="selectedDistiImg">

Can anyone help me on this issue?

cantoute commented 1 year ago

+1

Having same issue and can't really identify / isolate the problem. The bug occurs with specific images

one that creates the bug: https://boxemag.com/wp-content/uploads/2022/11/cihad-akipa.png

(It is served as webp and on this one the top of the image is transparent.)

It seams the problem has to do with "useSrcset", like displaying an image using srcset followed by one not using it.

As a temporary workaround I found that creating 2 <img> in the template combined with a *ngIf did the trick.

<img *ngIf="useSrcset" ... />
<img *ngIf="!useSrcSet" ... />