Gallery: Single Image on Content Page

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
caigner
Forum Members
Forum Members
Posts: 46
Joined: Sun Aug 16, 2020 5:29 am

Gallery: Single Image on Content Page

Post 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

Code: Select all

uploads/images/Gallery/misc 
Any help is appreciated.

Christian
I am using CMSms 2.2.19
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1622
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Gallery: Single Image on Content Page

Post by DIGI3 »

I think it needs to be the image number, I just did a test with:

Code: Select all

{Gallery img=1}
and it did what you're asking.
Not getting the answer you need? CMSMS support options
User avatar
caigner
Forum Members
Forum Members
Posts: 46
Joined: Sun Aug 16, 2020 5:29 am

Re: Gallery: Single Image on Content Page

Post 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:

Code: Select all

{Gallery img=1}
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.
I am using CMSms 2.2.19
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1622
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Gallery: Single Image on Content Page

Post 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.
Not getting the answer you need? CMSMS support options
Post Reply

Return to “Modules/Add-Ons”