Page 1 of 1
Gallery: Single Image on Content Page
Posted: Thu Aug 27, 2020 1:59 pm
by caigner
On one of my content pages I want to display a thumbnail of an image, and when I click on that thumbnail I want to display the image in lightbox.
I tried this in my content, but it doesn't show the thumbnail or the image:
Code: Select all
{Gallery dir="misc" img="myImage.jpg"}
The path to my image file is
Any help is appreciated.
Christian
Re: Gallery: Single Image on Content Page
Posted: Thu Aug 27, 2020 2:09 pm
by DIGI3
I think it needs to be the image number, I just did a test with:
and it did what you're asking.
Re: Gallery: Single Image on Content Page
Posted: Thu Aug 27, 2020 2:51 pm
by caigner
DIGI3 wrote: ↑Thu Aug 27, 2020 2:09 pm
I think it needs to be the image number, I just did a test with:
and it did what you're asking.
Hmm... looks simple. How do I integrate this in my HTML?
At the moment I have something like this:
Code: Select all
<p>How to reach us (click to enlarge):</p>
<a href="https://cms.mydomain.com/uploads/images/map.jpg">
<img src="https://cms.mydomain.com/uploads/images/map_320x240.jpg" width="320px" height="240px" title="map" alt="map">
</a>
Should I delete the whole link + img and replace it with {Gallery img=1} ?
How does the gallery know which image I want to display?
I tried
Code: Select all
<p>How to reach us (click to enlarge):</p>
{Gallery dir="/images" img="map.jpg"}
but that didn't work.
Re: Gallery: Single Image on Content Page
Posted: Thu Aug 27, 2020 2:59 pm
by DIGI3
I would make a Gallery single-image template that includes the link, so you could just do
Code: Select all
<p>How to reach us (click to enlarge):</p>
{Gallery img=1 template='my-template'}
You get the image number from the Gallery module - it's to the left of the image in the list when you open a gallery. I don't think there's a way to call a specific image by filename or title unless you create a template that tests for that in the foreach.
It might also be worth considering NOT using the Gallery module for this - if it's just in one or two spots I would hardcode it in the page template, and/or create a content_image field. Gallery seems a bit overkill for just adding one image with a lightbox.