bpatrik / pigallery2

A fast directory-first photo gallery website, with rich UI, optimized for running on low resource servers (especially on raspberry pi)
http://bpatrik.github.io/pigallery2/
MIT License
1.76k stars 202 forks source link

Linking directly to an image does not always open the image but the library where the image resides #614

Open kardo22 opened 1 year ago

kardo22 commented 1 year ago

If i have a library of 200 images and i share this library via sharing.

I link directly to the image generating a link such as:

https://gallery.test.test/gallery/Games%20FScreenshots%20(Test)?p=TestImage.jpg&sk=2cfd4b36

This will only open the actual image that is linked if the image within the visible part of the top of the folder. So lets say images goes from 001 to 200, and we sort by ascending by name. It will become 001.jpg is on top and 200.jpg is on the bottom.

Only 001-020 is visible when you open the library with the link from the top (depending on screen resolution), the rest is invisible and hidden with lazyload. If i link directly to image 001 to 020.jpg like:

https://gallery.test.test/gallery/Games%20FScreenshots%20(Test)?p=014.jpg&sk=2cfd4b36

It will open the webpage and then open the image with a fancy animation. However if link to an image that is outside the visible area from the top of library as such:

https://gallery.test.test/gallery/Games%20FScreenshots%20(Test)?p=066.jpg&sk=2cfd4b36

It will open the image library just like you linked directly to the image library and not actually open the image you linked to until you scroll far enough down so the image comes into the visible area, then the image will open.

I do not know how to resolve this, maybe it is an issue with lazyloading and how the code is fetched by the browser, as it seems the browser does not know the image exists on the page until you scroll down far enough so the page loads the image. Perhaps it would also be a performance issue if the entire block of code of images would have to be rendered in the browser on load if the library you open has a massive amount of images?

Anyway, this is just something i though could be improved upon but i do not know how to fix it.

kagahd commented 1 year ago

@kardo22, please see the feature request #497 to share one photo within the gallery. I think this one is a duplicate and as such may be closed.

kardo22 commented 1 year ago

@kagahd This is not a direct duplicate of request 497, although the feature is similar they have 2 different use case scenarios.

Lets say we are a couple of people in discord digging through a shared PiGallery album, it is a nice feature to be able for guests viewers to be able to share and direclty link images from this album (this obviously is possible now but its not very useful because like stated in this feature request if the image is not visible as the page loads it won't be displayed until the user scrolls down to where the image becomes visible).

It would also be nice as stated in requests 497 to have the ability as an admin to share a single picture from an album but not give access to anything else in that album.

Therefor i want to see these 2 feature requests as completely separate from each other.

kagahd commented 1 year ago

Understood, thanks for clarifying @kardo22 . I had a look at this and it seems that's possible already by calling PiGallery2's API. For example: the URL to show the last photo of Pigallery2 live demo, which is not visible when looking at the folder would be https://pigallery2.onrender.com/pgapi/gallery/content/IMG_1401.jpg/bestFit. You could also omit the /bestFit part to show the original photo independent of the viewport. Hope this helps.

bpatrik commented 1 year ago

@kardo22 I'm vaguely aware that if the linked photo is not in-view the app will take some time to scroll down and open that photo (which can confuse the user). Lets say this is a bug (I handle these with higher priority) and should be fixed :)

@kagahd This https://pigallery2.onrender.com/pgapi/gallery/content/IMG_1401.jpg/bestFit. wont work on its own in a password protected gallery as it does not contain the sharing key. (That would be a security issue if you could open any photos in a protected gallery)

kagahd commented 1 year ago

That would be a security issue if you could open any photos in a protected gallery

Thats for sure @bpatrik. I assumed that one is already logged in when calling the URL.