We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46668
    • 51 Posts
    I have a slight issue with using getImageList I think, I am trying to put a slideshow in the header of my site to show say last 5 images, if I have a parent page of 10 and the child resources are 11,12,13,14,15 then the only time the image from say ID 12 outputs is if I am on resource 12

    From a getResource call my getImageList is this
     [[!getImageList?
        &tvname=`resourcealbum`
        &tpl=`image`
        &limit=`1`
        &menutitle=`[[+menutitle]]`
        &parents=`10`
        &docid=`[[+id]]`
      ]]

    tpl image =
    <img src="[[+image:phpthumbof=`w=400&h=400&zc=1`]]" alt="[[+menutitle]]">


    The menu titles output fine and so the alt="" is the only thing that changes in the slideshow until the image of say the child resource I am on appears.

    I hope I am making sence have followed a few other examples of these excellent forums but this ones is beating me.

    Thanks all [ed. note: panfire last edited this post 10 years, 2 months ago.]
      • 46668
      • 51 Posts
      OK wanted to update/expand on my previous post,
      Looking at the html output I see this
      <img src="/assets/resourceimages/14/r1150b.jpg" alt="2003 03 Reg BMW R1150 1150 cc R1150 GS Adventure ABS, F.S.H ">
      
      <img src="/assets/resourceimages/14/harleysportster7.jpg" alt="2006 06 Reg HARLEY-DAVIDSON SPORTSTER 883 cc">
      
       <img src="/assets/resourceimages/14/bmw1200-9.jpg" alt="2006 06 Reg BMW R1200 1200 cc R1200 GS "><


      The problem seems to be that whatever page I am on the ID of that page is added to the folder location of where the images are instead of the proper ID.
      So for example /assets/resourceimages/14/ that 14 is the ID of the page I am viewing the output on so if I view from a page with an ID of 15 then that 14 would become 15.

      What have I done wrong!!!

      Thanks [ed. note: panfire last edited this post 10 years, 2 months ago.]
      • OK, so this has me confused.

        You have resources under the parent id of 10.
        These resources have MIGX grids, and each individual resource should only show it's own images from the MIGX grid.

        Am I correct?

        If so, you will need to omit the &parents (I don't even think &parents is valid for MIGX actually. Yep... pretty sure it's not.) and &docid parameters from your MIGX call, and let it grab it's own id as is default.

        You wouldn't want to use the docid parameter unless you want to grab the MIGX items from some other resource than the one you're calling MIGX on.




          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
        • What you need to do is use something like getResources or pdoResources to list the child resources, and in the tpl use a getImageList snippet with &docId=`[[+id]]`.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 46668
            • 51 Posts
            Yes sorry my post was not to clear posted after not able to get this to work and with frustration (-:

            ok I am trying to get images from child resources under another parent show up in the header of the site on all pages for a slideshow, these child resource all have images added with MIGx multi-upload function and output on their respective pages fine with just a getmageList call

            Here is all my calls:

            On a resource with an ID of 14 where I am testing this I have:
            [[!getResources? 
            &parents=`10`
            &tvname=`resourcealbum`
            &depth=`2`
            &tpl=`slide1`
            &includeTVs=`1`
            &processTV=`1`
            &showHidden=`1`
            &limit=`3`
            &element=`getResources`
            &sortdir=`desc`]]


            tpl slide1
            [[!getImageList?
                &tvname=`resourcealbum`
                &docid=`[[+id]]`
                &tpl=`slideImg`
                &limit=`1`
                &menutitle=`[[+menutitle]]`
            
              ]]


            tpl slideImg
            <img src="[[+image:phpthumbof=`w=400&h=400&zc=1`]]" alt="[[+menutitle]]">


            Output of above as follows:
            <img src="/assets/resourceimages/14/r1150b.jpg" alt="2003 03 Reg BMW R1150 1150 cc R1150 GS Adventure ABS, F.S.H ">
            
            <img src="/assets/resourceimages/14/harleysportster7.jpg" alt="2006 06 Reg HARLEY-DAVIDSON SPORTSTER 883 cc">
            
             <img src="/assets/resourceimages/14/bmw1200-9.jpg" alt="2006 06 Reg BMW R1200 1200 cc R1200 GS ">

            Images wont display as file path is wrong. The directory 14 in them paths is actually the ID of the page this getResources call is on and not the directory the images are stored in.

            If I ran this call from a page with an ID of 15 then they would all start with /assets/resourceimages/15/

            But the menutitle and the final image name are correct its when the getImageList loops though pages its inserting the page ID of where that getResources is on rather than inserting the directory number of where the image actually is.

            I know on the set up I had to add the following to the media source basepath and baseurl: [[migxResourceMediaPath? &pathTpl=`assets/resourceimages/{id}/`]]

            Seems like the {id} is getting the ID of the page the getresources call is on instead of where the image is.

            Sorry for my original confusion I hope this time I have explained it better and thanks for the help.

            Thanks
            [ed. note: panfire last edited this post 10 years, 2 months ago.]
              • 46668
              • 51 Posts
              Getting closer trying to use [[+property.docid]] in final chunk to get the correct path here's what I now have the getResources call is on a resource of ID 14
              [[!getResources? 
              &parents=`19`
              &depth=`1`
              &tpl=`slide1`
              &processTV=`0`
              &showHidden=`1`
              &limit=`3`
              &element=`getResources`
              &sortdir=`desc`]]

              slide1
              [[!getImageList?
                  &tvname=`resourcealbum`
                  &tpl=`slideImg`
                  &limit=`1`
                  &menutitle=`[[+menutitle]]`
                  &docid=`[[+id]]`
                ]]

              slideImg
              <li><img src="assets/resourceimages/[[+property.docid]]/[[+image:phpthumbof=`w=382&h=299&zc=1`]]" alt="[[+menutitle]]"></li>

              output of this
              <li><img src="assets/resourceimages/49//assets/resourceimages/14/r1150b.jpg" alt="2003 03 Reg BMW R1150 1150 cc R1150 GS Adventure ABS, F.S.H "></li>
              
               <li><img src="assets/resourceimages/48//assets/resourceimages/14/harleysportster7.jpg" alt="2006 06 Reg HARLEY-DAVIDSON SPORTSTER 883 cc"></li>
              
               <li><img src="assets/resourceimages/47//assets/resourceimages/14/bmw1200-9.jpg" alt="2006 06 Reg BMW R1200 1200 cc R1200 GS "></li>

              so all I need to do is find a way of stopping [[+image:]] part of that final chunk of outputting a path but keep in the final image name.

              I really am at a loss now anyone have any ideas I am out of them.

              Thanks

              update

              Got the above code working by moving &processTV=`0` from the getResources call to the getImageList call.

              Only thing now this has stopped the phpthumbs from working if I can just fix that I am sorted. [ed. note: panfire last edited this post 10 years, 2 months ago.]
                • 4172
                • 5,888 Posts
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 46668
                  • 51 Posts
                  OK getting this put this into practice looses me totally so if I have this:
                  <li><img src="assets/resourceimages/[[+property.docid]]/[[+image:phpthumbof=`w=382&h=299&zc=1`]]" alt="[[+menutitle]]"></li>

                  Then my filter would be added to the getImageList call like this
                  &where=`[[+tv.resourcealbum:add_before=`assets/resourceimages/[[+property.docid]]/`:phpthumbof=`w=382&h=299&zc=1`]]`


                  My latest getImageList call now is this
                  [[!getImageList?
                      &tvname=`resourcealbum`
                      &tpl=`slideImg`
                      &limit=`1`
                      &menutitle=`[[+menutitle]]`
                      &processTVs=`0` 
                      &prepareTVs=`0`
                      &docid=`[[+id]]`
                      &where=`{+tv.resourcealbum:add_before=`assets/resourceimages/[[+property.docid]]/`:phpthumbof=`w=382&h=299&zc=1`}`
                    ]]

                  That outputs the images in full size without the phpthumb.
                  Am I getting close might need a code example

                  Many thanks


                  [ed. note: panfire last edited this post 10 years, 2 months ago.]
                    • 4172
                    • 5,888 Posts
                    the snippet-call:

                    [[!getImageList?
                        &tvname=`resourcealbum`
                        &tpl=`slideImg`
                        &limit=`1`
                        &processTVs=`0` 
                        &menutitle=`[[+menutitle]]`
                        &docid=`[[+id]]`
                      ]]


                    the chunk slideImg:

                    <li><img src="[[+image:add_before=`assets/resourceimages/[[+property.docid]]/`:phpthumbof=`w=382&h=299&zc=1`]]" alt="[[+menutitle]]"></li>
                    
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 46668
                      • 51 Posts
                      OK I was embarrassingly not even close and thanks for the example, well I have tried it but outputs just the image name like "bmw1200-9.jpg" the add before is not working.

                      Do I need to add any package so that MODx knows to look for the filter or should that just work.
                      Ive tried clearing the cache publishing the page but I cant get the filter to work.

                      Thanks Bruno very much for your time so far

                      Yan