Show only one image from gallery

Admiror Gallery is free extension for Joomla! 1.6. Joomla! 1.7 and Joomla! 2.5 based websites. Admiror Gallery is all in one, a simple and instant solution for rendering image gallery from folder with images, but very flexible and adaptable.
Post Reply
Message
Author
SanderNobel
Posts: 2
Joined: Thu Oct 10, 2013 11:14 pm

Show only one image from gallery

#1 Post by SanderNobel »

Hi Vasiljevski,

First of all thank you for this perfect gallery plugin.

Now my question.
On different locations in my articles I have placed images.
Now I would like to use admiror gallery to open each image as if it was an image from a gallery.

Currently I solve this by putting each image in a seperate folder and then add this folder as a gallery in the article.
Thus I have multiple galleries in my article and each gallery containt one image.
In this case the caption works nicely and all images open in the same way.
I also have one forder containing all images, so I can open it as a normal galley as well.

Now I am wondering if it is possible to have all images in the same folder or gallery and then when adding this gallery multiple times to the article, for each time select a different image from that folder.

I have been searching through this board, but could not find anything.

Thanks in advance for an answer,

With kind regards,

Sander

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: Show only one image from gallery

#2 Post by Vasiljevski »

Well this seems as a nice feature, but currently it is not supported in the default installation.
But maybe it could be done with some small code changes.

Let say that you use classic template, open index.php found in classic folder and change this part:

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.= '<a href="' . $AG->imagesFolderPath . $imageName . '" target="_blank"><input type="button" value="Download"></a>';              
        $html.='</span>';
    }
}
into this:

Code: Select all

$singleImage = $AG->ag_getParams("image", $match, null);
// 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)) {
    if($singleImage)
    {
        $html.= '<span class="ag_thumb' . $AG->params['template'] . '">';
        $html.= $AG->writePopupThumb($singleImage);            
        $html.='</span>';
    }
    else
    {    
        foreach ($AG->images as $imageKey => $imageName) {
            $html.= '<span class="ag_thumb' . $AG->params['template'] . '">';
            $html.= $AG->writePopupThumb($imageName);              
            $html.='</span>';
        }
    }
}
So now when you need just one image just set {AG single_image="apple1.jpg"}fruitshop{/AG} and only that image will appear :)
single_image - should be picture name relative to the gallery that is shown. In the case above I have my image is "/images/sampledata/fruitshop/apple1.jpg"
Help Admiror Gallery become even better,
give us a review on JED

SanderNobel
Posts: 2
Joined: Thu Oct 10, 2013 11:14 pm

Re: Show only one image from gallery

#3 Post by SanderNobel »

Hi Vasiljevski,

Sorry for my late response and first of all I would like to thank you for your effort making this possible.
This really works like a charm.

Maybe it is possible for a next version of admiror to add this as an option in the editor button.
Now you can select only the folder for the gallery.
Would be easy to add another option with selector to provide the file name, or even beter, select the file from the given folder.

I am trying to create this as an editor butten myself, but I am not a programmer, so it will take a while.

Nevertheless This really helped with improving my website and I am recomending admiror gallery to others.

With kindest Regards,

Sander Nobel

Post Reply