Piwigo / piwigo-bootstrap-darkroom

A mobile-ready and feature-rich theme for Piwigo photo gallery, based on Bootstrap 4
Apache License 2.0
83 stars 40 forks source link

Allow direct linking of photos with PhotoSwipe enabled #318

Open sebageek opened 2 years ago

sebageek commented 2 years ago

I would like to be able to share a direct link to a photo when the thumbnail link is set to "PhotoSwipe slideshow".

When clicking on a link (with the "PhotoSwipe slideshow" setting) I can browse the photos and see that the URL changes for each photo (I see a &gid=1&pid=2 in the URL). I think it would be nice if I could give that link to a friend and they could see the photo I'm seeing (people looking at my gallery often use this link to talk about a specific photo to me). As the URL already has all the necessary information, we could just parse out the pid=x image, substract one (as pid is 1-based in the url, but the photo enumeration is 0-based) and start the PhotoSwipe with it.

plegall commented 2 years ago

I gave a try to your pull-request. It doesn't work. When I copy paste a photoswipe URL, it simply doesn't open photoswipe :-/

sebageek commented 2 years ago

Hey, thanks for looking into this. I saw a release was already made with the proposed change. I updated the theme in my piwigo instance to 2.5.5 (overriding my local changes in the theme) and it still seems to work for me.

As an example, here is a directly-linked picture of a seagull standing in grass: https://photos.seba-geek.de/index/category/15#&gid=1&pid=2

Opening this in firefox in private mode (to make sure I'm not logged in or anything) first opens the image overview and then immediately acts like I clicked on the thumbnail of said picture. Does this work for you with my instance? Do you have an instance of piwigo I could take a look at?

This might also be related to the plugins I have installed alongside, maybe one of these is the culprit:

sebageek commented 2 years ago

It works for me on all tested desktop browsers, but I can reproduce it with my smartphone browser (firefox; a friend tested chrome as well). Did you test this with a smartphone as well? Peculiarly it seems to work on my desktop's firefox with "mobile view" enabled in developer tools.

sebageek commented 2 years ago

Okay, after a fair share of trying to debug this in my gallery I figured out that my problem was that the default theme on mobile was SmartPocket. Disabling all other themes made the direct links work on mobile as well (I bet there is another way to solve it, but I don't need the other themes anyway).

So I can't reproduce it (except when choosing the wrong theme). @plegall can you maybe describe your issue a bit more or help us reproduce it?