<![CDATA[ Easiest way to randomly select one image from each gallery? - My Forums]]> https://forums.modx.com/thread/?thread=98049 <![CDATA[Easiest way to randomly select one image from each gallery?]]> https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530232
The 3 pictures could be randomly selected either when the page is loaded --with the paths to the pictures stored in hidden fields-- or dynamically when one of the link is clicked.

Should I write a snippet or is there a "built-in" easier solution?

Furthermore, it would be nice if the user could then browse the gallery that he selected.
I assume that I should use one of the plugins for this.

Thanks for your advice.]]>
Jul Aug 19, 2015, 11:39 AM https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530232
<![CDATA[Re: Easiest way to randomly select one image from each gallery?]]> https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530688 I'm using the 1.4.0 RC1 (as I like its interface more than thus of the current 1.4.14 version).

I saw that &rgid is currently also mentioned in the rtfm documentation.

From my tests:

1) With these parameters, &rand_tpl is ignored and you must use &tpl instead:
&gid=`...` &orderby=`random` & limit=`1`

2) By simply setting &rgid, &rand_tpl is taken into account.
(other parameters from point 1 are not necessary)

3) With parameters from point 1 and no wrapper is output around the thumbnails

4) With &rgid=`...` some wrapper is output, but &dir_tpl is ignored

I'm not sure about what &gal_desc=`1` really does, as I cannot see differences when its set to 1 or 0.

My snippet calls are as follows:
[!easy2? &gid=`2` &rgid=`2` &gal_desc=`0` &dir_tpl=`assets/modules/easy2/templates/(...)/directory.tpl` &rand_tpl=`assets/modules/easy2/templates/(...)/random_thumbnail.tpl`!]
[!easy2? &gid=`2` &rgid=`3` &gal_desc=`0` &dir_tpl=`assets/modules/easy2/templates/(...)/directory.tpl` &rand_tpl=`assets/modules/easy2/templates/(...)/random_thumbnail.tpl`!]


I would like the "thumbnails" to display only the folder name (or the title) and to store the path to the picture in an hidden input field. The template for &rand_tpl is:
<div class="thumb">
  <div class="boxcontent">
    <input type="hidden" value="[+easy2:link+]" />
  </div>
</div>

but could even be:
<input type="hidden" value="[+easy2:link+]" />


I'm not especially interested in the thumbnails features, as custom code will handle the clicks on the gallery names.

As &dir_tpl seems being ignored, I cannot see how to specify the wrapper, unless modifying the code of the default one. Any solution?]]>
Jul Aug 28, 2015, 10:18 AM https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530688
<![CDATA[Re: Easiest way to randomly select one image from each gallery?]]> https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530667
Best choice if your version is not original, is to use the rtfm documentation which includes 1.4 info, or as it says in the docs for 1.3.5, use the help within the module. If &rgid=`2` isn't working, there's probably a good reason for it (version).

https://rtfm.modx.com/extras/evo/easy-2-gallery


Select Previous Release to get 1.3.5 version (it's still a working module, but uses different file's basename)
The original author is Cx2.

The maintainer of version 1.3.5 (which uses ID number as the file system) is Temus.
Forum:

Module-Easy 2 Gallery - russian board (ru)
Support/Comments for Easy 2 Gallery 1.3.5-release

The developer of version 1.4.x (which keeps the names in the file system) is goldsky.
The most updated HELP is on the Module's Help tab.



]]>
frogabog Aug 27, 2015, 07:59 PM https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530667
<![CDATA[Re: Easiest way to randomly select one image from each gallery?]]> https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530438 If the wiki is correct, &rgid=`2` should be equivalent to &gid=`2` &orderby=`random` &limit=`1`.]]> Jul Aug 24, 2015, 08:52 AM https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530438 <![CDATA[Re: Easiest way to randomly select one image from each gallery?]]> https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530247
For Easy2Gallery - try the rtfm documentation at https://rtfm.modx.com/extras/evo/easy-2-gallery. The wiki is far less comprehensive and I doubt any updates are done there anymore.

&orderby - Field by which thumbs will be sorted out: date_added, last_modified, comments, filename, name, random.

Further down the page, find this:

Random thumbnail output

You should use limit = `1` and random order (orderby=`random`)
In this case random_tpl is used.
WARNING: you need to modify rand_tpl and set there url of your gallery page.

e.g.
you have gallery.html (page where main gallery resides) and want to put random pic on your main page or anywhere else.

you put [!easy2? orderby=`random` & limit=`1`!] anywhere you want and modify random_tpl from...

There's a bit more on that page with sample chunks for random output, and also info for randomizing the albums, etc.

For your next and previous pagination:
Prev/Up/Next navigation

&nav_prevUpNext - 0 | 1 (on or off)

&nav_prevUpNextTitle - cat_name | cat_alias

&nav_prevSymbol - «

&nav_upSymbol - ^^

&nav_nextSymbol - »
Pagination (1.4.0)

Some people just don't like to use pagination, so use this to turn it off:

&pagination - 0 | 1


If you wanted the images to display in a swipable jquery lightbox, this is a really nice little gem. And it looks great on Apple and Android mobile devices.
http://brutaldesign.github.io/swipebox/

]]>
frogabog Aug 19, 2015, 06:39 PM https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530247
<![CDATA[Re: Easiest way to randomly select one image from each gallery?]]> https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530238 (I'm using Evo. MIGX is for Revo.)

The link you posted is for Gallery.
I'm able to randomly pick an image with other snippets like MaxiGallery for instance, but this time, I need to use Easy2Gallery (snippet's name is easy2) as Easy2Gallery is the backend that I use to manage the pictures.

What I want to achive is something like this.
[!easy2 &rgid=`2` &limit=`1` &dir_tpl=`display_gallery_title` &rand_tpl=`tpl_for_random_pic` !]  
[!easy2 &gid=`3` &limit=`0`  &dir_tpl=`display_gallery_title` !]  
[!easy2 &gid=`4` &limit=`0`  &dir_tpl=`display_gallery_title` !


I've not tested this code, but I think I'm on the track.
The wiki describes what &gid, &rgid and &fid are:
http://wiki.modxcms.com/index.php/Easy2gallery#Templates_parameters

&rgid is for random.

What I also would like if possible is having "previous" and "next" buttons on the template where the random picture is displayed, so that the user can explore miscellaneous images. Those should be loaded in Ajax and I wonder if one of the plugins available for Easy2Gallery make this easily.

The most difficult for me, is my lack of overview of what easy2 is able to do straight, and what has been to be coded with jQuery or so.
Thanks.]]>
Jul Aug 19, 2015, 12:50 PM https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530238
<![CDATA[Re: Easiest way to randomly select one image from each gallery?]]> https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530234
This may help some http://forums.modx.com/index.php?action=thread&thread=52717&i=1

]]>
frogabog Aug 19, 2015, 12:06 PM https://forums.modx.com/thread/98049/easiest-way-to-randomly-select-one-image-from-each-gallery#dis-post-530234