Is there a way to update the current picture displayed.
The use case here is that I added a button in the gallery to rotate the picture. So the picture is rotated on the server side but then I would like to update the picture in the client side.
Thanks a lot for any help on this !
pswp.currItem.src = 'image.jpg';
pswp.currItem.w = 123;
pswp.currItem.h = 456;
pswp.currItem.needsUpdate = true;
pswp.updateSize(true);
Thanks for your prompt reply.
I'm still facing the issue, but according to my tests, the issue is because my photo still have the same name. Indeed, if I try to refresh with one of the 3 pictures in the PhotoSwipe "cache", the photo is not retrieved from the server. Is there any way to force the refresh of the 3 pictures?
The only way I found is to manually delete the src attr before refreshing:
$(".pswp__img[src='"+ source +"']").attr("src", "");
That's ok, finally, I choose another way which is to add "?"+random_number at the end of the image url so that it is changing the url and the browser is "forced" to get the picture from the server.
@dimsemenov This was really helpful - any way we can get needsUpdate added to the documentation?