How can I use images cached on device for each slide's 'src'? #1269

Open
jamminjames opened this Issue Jan 9, 2017 · 1 comment

Projects

None yet

1 participant

@jamminjames

Okay, another newbie question here. I'm using PhotoSwipe in an app, and I designed it so that I can update the images without updating the app, importing them from a remote server. It's working as it is, but sometimes there's a bit of a lag, even with the preload set to 3 slides ahead. So, I'd like to serve images that have been cached on the device, if possible.

I'm using ImgCache to cache the images, which is working great. The problem is, it generates random names for each cached image (like 490786b2a5f524cf2639e042d6518b6ba40c9461.jpg). However, it does also include an attribute on each cached image called 'data-old-src', which gives the original image's address. So, I'm hoping that attribute can somehow be used to tie the correct cached image to each slide of the array.

Any ideas would be most welcome. Thank you!

@jamminjames

I also have the problem of old images being shown in the app, when I've updated the images on the server. So, would it be better to just use a general cache plugin like https://github.com/Chialab/resources-cache-js or https://github.com/Innoruptor/ClearCache? Something that checks the file to see if it's changed, and upload the new one if it has. Can anyone steer me in the right direction? I'd be very grateful. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment