Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Share picture from Gallery not working

  • #5732
    Avatar photo[anonymous]

    Hello,

    I hope you can help as I have rebuild my photo portfolio website with Publii and now face a critical issue. I am using the gallery a lot. Unfortunately sharing specific pictures from a gallery does not work at all and I was able to reproduce it on the theme demo pages for Mercury and Photography themes.

    If you open a picture the URL changes, which is promising. However if you share this URL, it seems like these parameters are not processed or passed to the gallery component and the picture is not opened. This also renders the ‘share’ buttons on the gallery useless. If you use for example the Facebook share button it shares exactly the same URL as in the address bar and does not open the image, but just the page that has the gallery embedded.

    As the URL is changing for each opened image my hope is that this can be fixed and the shared image will be automatically opened if such an URL is called.

    For example with this URL: https://demo.getpublii.eu/themes/mercury/3/gallery/#&gid=1&pid=2 I would like to share the headphones image from the Mercury demo page. But instead of opening this image, it just opens the Gallery page.

    Another thing that is missing, but I am not sure whether this is possible with a static site generator: If I share such a image in a gallery on Facebook that image should also be used as preview image for the URL. With that it would be perfect. But as a minimum requirement I would need the link open the shared image.

    Really hope this gets fixed as otherwise I absolutely love Publii and would like to get the Photography theme, but right now this is a showstopper for me 🙁

    Thank you very much.

    #5733
    Avatar photoBob

    Publii uses Photoswipe’s gallery engine to generate galleries; also the share feature, originally provided by the Photoswhipe script, works exactly the same, check it out here: https://photoswipe.com/

    #5734
    Avatar photoBob

    My fault, I didn’t notice the problem before, now I see. I will try to fix it asap.

    #5735
    Avatar photo[anonymous]

    Thank you very much!!!

    Another (less important issue)

    If you open this URL: https://demo.getpublii.eu/themes/mercury/3/gallery/#&gid=1&pid=2 (headphones image) you get the page without the image opened as said before. If you click on the sailboat however, Photoswipe opens the headphones. But that is really a minor issue in comparison and I guess it will be solved, when the photo is opened after launching the URL.

    #5736
    Avatar photoBob

    Yeap I know, this is exactly the same problem and reason why the “social URLs” do not open the selected picture.

    #5745
    Avatar photoBob

    For a quick fix open the photoswipe.hbs ‎⁨file (Documents ▸ ⁨Publii⁩ ▸ ⁨sites⁩ ▸ ⁨YOUR_SITE ▸ ⁨input⁩ ▸ ⁨themes⁩ ▸ ⁨YOUR_THEME ▸  partials) and change the following piece of code:

    initPhotoSwipeFromDOM('.gallery');

    to

    window.addEventListener('load', function () {
        initPhotoSwipeFromDOM('.gallery');        
    }, false);

    It should help.

    #5750
    Avatar photo[anonymous]

    Works like a charm. Thanks so much for the quick help. Awesome!

    Donation on the way…