New Community Forums are coming. Watch this space for news.
Subscribe: RSS
  • In order to allows swiching the background between pictures coming from three galleries, I'm looking for the easiest way to display a simple link for each gallery name and to display one picture, randomly selected in this gallery when the link is clicked.

    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.
    • Where are the gallery images coming from? Gallery? MIGX? You can set MIGX to &randomize=`1` for random output. I don't use Gallery, but there should be a sorting parameter to set to rand for it.

      This may help some http://forums.modx.com/index.php?action=thread&thread=52717&i=1

        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
      • The gallery images are coming from Easy2Gallery itself.
        (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.
        • Sorry, I should probably pay attention to which forum things are posted in.

          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- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster
          • Thanks a lot.
            If the wiki is correct, &rgid=`2` should be equivalent to &gid=`2` &orderby=`random` &limit=`1`.
            • I think the point may have been missed. The Wiki is not up to date, hasn't been for a long while and likely only applies to the original version 1.3.5 which uses a different file's basename. This Extra has been updated once to use the ID, and is now maintained by someone else. There is also a developer version 1.4. Which version are you using? It appears that it matters.

              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- MODX Websites in Portland Oregon
                "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                Having server issues? These guys have MODX Hosting perfected - SkyToaster
              • Thanks.
                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?