We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37451
    • 8 Posts
    Hope someone can help me out. I've build a site using Gallery to manage images. Works like a charm, but when I open a page it should start with the first item available in the album. currently it doesn't and leaves the page blank with only the thumbs to display. When I click on a thumb the galitem loads like it should. The code looks like:
    [[!Gallery? &thumbWidth=`50` &thumbHeight=`50` &limit=`10` &album=`Myalbum`]]
    [[!Gallery? &toPlaceholder=`gallery` &thumbWidth=`50` &thumbHeight=`50`]]
    [[!GalleryItem]]
    [[!GalleryAlbums? &toPlaceholder=`galleries`]]
    <div class="image"> [[!+galitem.image:notempty=`<img src="[[+galitem.image]]"/>`]]</div>

      • 3109 ☆ A M B ☆
      • 894 Posts
      Try changing your gallleryItem call to something like this:

      [[!GalleryItem? &id=`1`]]
      


      That way it loads the image you specify initially.

      Hope that helps.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 37451
        • 8 Posts
        Hi Ben,

        This was also my first try and it nicely displayed the item with the id 1. When you have multiple galleries not all have an item with the ID 1, so it won't work with multiple galleries. The code should look something like this, but I don't know what to use to call the first item.

        [[!galleryItem? &id=`id of first item]]


        Regards,


        Jaap
          • 37451
          • 8 Posts
          The idea is to link each menuitem/document to a gallery. When a menuitem is chosen the page should open, displaying the first picture of the album and the thumbs. The thumbs are working, but the first image doensn't load. Here is a link to site to visualize this.

          http://stijnboemaars.nl/index.php?id=10
            • 3109 ☆ A M B ☆
            • 894 Posts
            I had a similar issue once and I used another gallery call like this:

            
            [[!Gallery? &album=`gallery album Id goes here` &useCss=`0` &thumbTpl=`thumb tpl` &limit=`1` &toPlaceholder=`placeholder name of galleryItem`]]
            
            


            And the thumb tpl had:

            [[+image_absolute]]
            


            If it has the same placeholder name as the galleryItem when you click on the thumbnails it will replace whatever image is there.

            Hope that works for ya.
              Benjamin Marte
              Interactive Media Developer
              Follow Me on Twitter | Visit my site | Learn MODX
              • 37451
              • 8 Posts
              I'm not sure on how to use this. Should it be like?

              [[!GalleryItem? &id=`[[+image_absolute]]`]]


              At the Gallery documentation I found a placeholder which could do the job, but I'm not sure how to use it. The place holder is: galitem.first.id


                • 37451
                • 8 Posts
                Created a workaround by a TV. This way a picture can be chosen from an album to be the first to show for each document. When thumbs are clicked it will be replaced by the selected one. Code looks like:

                [[!If? &subject=`[[!+galitem.id]]` &operator=`empty` &then=`[[*firstpic]]` &else=`<img src="[[+galitem.image]]"/>`]]


                Where firstpic is the image from the TV.
                  • 36426
                  • 197 Posts
                  Hi this solution works, but I'm now also stuck if anyone can help at all? For some reason it fails when Gallery item IDs get higher than 100???

                  https://forums.modx.com/thread/98144/snippet-not-working-right-all-the-time#dis-post-530695
                    Yorkshire UK based hosting provider: https://www.simulant.uk
                    • 13743
                    • 4 Posts
                    Quote from: jonahnaylor at Sep 01, 2015, 01:34 AM
                    Hi this solution works, but I'm now also stuck if anyone can help at all? For some reason it fails when Gallery item IDs get higher than 100???

                    https://forums.modx.com/thread/98144/snippet-not-working-right-all-the-time#dis-post-530695

                    In other developments I've used the gallerific plugin on top of the gallery. This automaticly starts using the first image of a gallery and might also be an option for you.