getgrav / grav-premium-issues

Official Grav Premium Issues repository to report problems or ask questions regarding the Premium products offered.
https://getgrav.org/premium
7 stars 2 forks source link

[lightbox-gallery] Shortcode fails to display image (bugfix included) #382

Closed gubser closed 11 months ago

gubser commented 11 months ago

Hi,

I've bought Lightbox Gallery v1.0.5 recently and installed it on Grav v1.7.42.3 and using the following Markdown in a modular page and image path resolution doesn't work:

[lightbox image="someimage.jpeg" zoomable="false" draggable="false"]
![White V12 Vantage](someimage.jpeg?cropZoom=200,200)
[/lightbox]

As you will see, the thumbnail uses the correct path but the lightbox does not. The link is rendered as

<a href="someimage.jpeg" class="glightbox " data-gallery="b1f65ea5b1b530cf88b84b3eff9315f6" data-type="image" data-zoomable="false" data-draggable="false">
    <p><img alt="White V12 Vantage" src="/images/f/a/2/1/c/fa21c1281511dc66a10717f440f76e3032ec8c1b-someimage.jpeg"></p>
</a>

and the lightbox is rendered as:

<div
  id="glightbox-body"
  class="glightbox-container glightbox-clean"
  tabindex="-1"
  role="dialog"
  aria-hidden="false"
>
...
            <div class="gslide-media gslide-image">
              <img src="http://localhost:8000/de/someimage.jpeg" alt="" />
            </div>
...
</div>

I've recently started creating my own shortcodes and wondered about line 16 in LightboxGalleryShortcode.php. I fixed my problem by replacing

'page'          => $this->grav['page'],

with

'page'          => $this->shortcode->getPage(),

and it works. Could you apply the fix this and release a new version? Thank you!

rhukster commented 11 months ago

Thanks, i have updated the plugin with your solution, I realize that the current code is not modular-page safe.

1.0.6 should be available soon.

Cheers!