Keyword
Please note that official support for commercial extensions & templates is provided in the Subscriber Help Desk.
Support requests should ONLY be directed there and require an active subscription plan.
This forum board is to be used for archive purposes and knowledge exchange ONLY.

Restrict Number Of Images

  • Richard Southern
  • Richard Southern's Avatar Topic Author
  • Offline
  • New Member
More
8 years 3 weeks ago #152620 by Richard Southern
Restrict Number Of Images was created by Richard Southern
Hi,

We are using Gallery Pro and wondered if we have a folder containing many pictures (100's) is it possible for the gallery to randomly show just ten of the images.

Currently we move the latest 10 images uploaded into their own folder and use that to achieve this.

Any help appreciated.

Thanks
Riichard

Please Log in or Create an account to join the conversation.

More
8 years 3 weeks ago #152665 by Lefteris
Replied by Lefteris on topic Restrict Number Of Images
Hi,

No, unfortunately there is no such functionality in Simple Image Gallery PRO. However, if you have an active subscription we can provide you with a workaround. Just create a ticket to our help desk system.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #154011 by Hrvoje Znaor
Replied by Hrvoje Znaor on topic Restrict Number Of Images
Hello

I needed same option, + option to randomize images.
So if you aren't afraid of tweaking original code here is how I did it:

1. Backup original files !!!

2. In plugins/content/jw_sigpro/jw_sigpro.php file, below
$gal_template = (array_key_exists(6, $tagparams) && $tagparams[6] != '') ? $tagparams[6] : $thb_template;
approx line 228, I added this:
$gal_random = (array_key_exists(7, $tagparams) && $tagparams[7] != '') ? $tagparams[7] : $gal_rand;
$gal_nr_imgs = (array_key_exists(8, $tagparams) && $tagparams[8] != '') ? $tagparams[8] : $gal_nr_img;

1st line is to add random option in curly brackets
2nd line is to set number of photos

3. I wanted to use used responsive layout, so duplicated

plugins/content/jw_sigpro/tmpl/responsive folder
it and renamed it into mywebsitename,
Open default.php file and find this line:

foreach($gallery as $count=>$photo):

and change it into:

$img_nr = 0;
if($gal_random){
shuffle($gallery);
}
foreach($gallery as $count=>$photo):
if($gal_nr_imgs){
if($img_nr == $gal_nr_imgs){
break;
}
$img_nr++;
}

4. In SIG pro change default layout to yours,
OR override it:
{gallery}path/foldername::::::yourlayoutname:random:4{/gallery} - 4 photos random

5. Now you can use various combinations:

{gallery}path/foldername:::::::random:4{/gallery} - 4 photos random
{gallery}path/foldername::::::::5{/gallery} - only 5 photos, default ordering
{gallery}path/foldername:::::::random{/gallery} - all photos, random

Hints:
- Number of : in curly brackets is important. If you use other overriding options, such as thumbnail size code will differ:
{gallery}path/foldername:150:150:1:1:jquery_fresco:random:random{/gallery}
- Instead of "random" you can use just "r".
- Upgrading SIG pro will overwrite your change in jw_sigpro.php file. So be sure to write down a note what you did.

HTH
Regards

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum