Showing just the first image of the gallery

Admiror Gallery 5.x.x for Joomla 3.x. support forum.
Post Reply
Message
Author
nielsvaes
Posts: 5
Joined: Wed Feb 05, 2014 11:47 pm

Showing just the first image of the gallery

#1 Post by nielsvaes »

I was wondering if there's a way to do the following:

Just show the first image of the gallery. Then if a visitor clicks on that image, a lightbox opens where the rest of the images are shown in a thumbnail at the bottom and the visitor can click through them.

Example:
http://www.fishermanholidays.com/en/domaine-de-bouxier

Click on Swim Pictures or Pictures Catches.

Is there any way to do something like this with Admiror Gallery?

I know you can set the Gallery template to galleryView, but I would like this gallery to show up in a popup or a lightbox popup.

Admiror Gallery 5 - Fundraising Campaign

User avatar
Vasiljevski
Developer
Developer
Posts: 1258
Joined: Sat Aug 14, 2010 9:31 pm
Location: Novi Sad, Serbia
Contact:

Re: Showing just the first image of the gallery

#2 Post by Vasiljevski »

Well there is no out-of-the-box way, but you can do this in several ways with slightly changing the index.php of the, for example, classic template.

In classic template, we have this part of code:

Code: Select all

// Loops over the array of images inside target gallery folder, adding wrapper with SPAN tag and write Popup thumbs inside this wrapper
if (!empty($AG->images)) {
    foreach ($AG->images as $imageKey => $imageName) {
        $html.= '<span class="ag_thumb' . $AG->params['template'] . '">';
        $html.= $AG->writePopupThumb($imageName);
        $html.='</span>';
    }
}
As you can see , on template level, you have access to the images that should be shown ($AG->images)
In you case, you could do is:

Code: Select all

$first_image = true;
if (!empty($AG->images)) {
    foreach ($AG->images as $imageKey => $imageName) {
        if($first_image)
        {
              $html.= '<span class="ag_thumb' . $AG->params['template'] . '">';
              $html.= $AG->writePopupThumb($imageName);
              $html.='</span>';
              $first_image=false;
        }
        else
        {
              $html.= '<span class="ag_thumb' . $AG->params['template'] . '" style="display:none;">';
              $html.= $AG->writePopupThumb($imageName);
              $html.='</span>';
              $first_image=false;
        }
    }
}
This is just a dirty example, just to explain the idea what is possible.
Hope this helps.
Help Admiror Gallery become even better,
give us a review on JED

Post Reply