We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29597 ☆ A M B ☆
    • 350 Posts
    I have a media source now with this as base_url and base_path
    [[migxResourceMediaPath? &pathTpl=`assets/gallery/{alias}/`&createFolder=`1`]]


    The solution works great on the detail page. like:

    <img src="[[*hoofdafbeelding]]" alt="[[*pagetitle]]">


    The image works, the path is:
    assets/gallery/client-a/meeting_room.jpg

    But if I use it on a page in a getResources call:

    The getResources call:
    [[!getResources?
        &parents=`[[*id]]`
        &tpl=`gallery_row_tpl`
        &includeTVs=`1`
        &processTVs=`1`
        &tvPrefix=``
        &limit=`0`
         &sortby=`RAND()`
    ]]
    


    The gallery_row_tpl:
    <img src="[[+hoofdafbeelding]]" alt="[[+pagetitle]]">
    


    The path to the image is wrong:
    assets/gallery/client-overview/image_001.jpg

    How do I use this correctly in a getResources call?

    I tested usting a MIGX in the getResources tpl:
    [[!getImageList? &tvname=`image` &tpl=`galleryImage` &limit=`1` &docid=`[[+id]]` ]]


    And now it works fine! But I don't need a MIGX with several images, just one single image TV.

    Can I somehow use the &docid=`[[+id]]` in a normal image TV?

    This question has been answered by Bruno17. See the first response.

      MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
      DESIGNfromWITHIN, MPThemes and Any Screen Size
      Follow me on Twitter | Read my blog | My code on GitHub
      • 4172
      • 5,888 Posts
      in a getResources-tpl you will need to add the path manually

      assets/gallery/[[+alias]]/[[+hoofdafbeelding]]


      the snippet in your mediasource
      [[migxResourceMediaPath? &pathTpl=`assets/gallery/{alias}/`&createFolder=`1`]]

      doesn't know anything about the resource, which is listed by getResources at this time, while getImageList does and tells it to the mediasource as soon, as you add the property &docid
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 29597 ☆ A M B ☆
        • 350 Posts
        Strange it is not working for me.

        The getResources call:
        [[!getResources?
            &parents=`[[*id]]`
            &tpl=`gallery_row_tpl`
            &includeTVs=`1`
            &processTVs=`0`
            &tvPrefix=``
            &limit=`0`
            &sortby=`RAND()`
        ]]
        


        gallery_row_tpl:
        <img src="assets/gallery/[[+alias]]/[[+overzichtafbeelding]]" alt="[[+pagetitle]]">
        


        Media source baseUrl and basePath:
        [[!migxResourceMediaPath? &pathTpl=`assets/gallery/{alias}/` &createFolder=`1`]]
        


        The path I get when using the getResources call on a page with alias of 'gallery-overview-page':
        assets/gallery/client-a/assets/gallery/gallery-overview-page/./jets.jpg

        Should be:
        assets/gallery/client-a/jets.jpg
          MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
          DESIGNfromWITHIN, MPThemes and Any Screen Size
          Follow me on Twitter | Read my blog | My code on GitHub
          • 29597 ☆ A M B ☆
          • 350 Posts
          Fixed with adding:
          &prepareTVs=`0`
          


          The final getResources call:
          [[!getResources?
              &parents=`[[*id]]`
              &tpl=`gallery_row_tpl`
              &includeTVs=`1`
              &processTVs=`0`
              &prepareTVs=`0`
              &tvPrefix=``
              &limit=`0`
              &sortby=`RAND()`
          ]]
          


          Thanks so much Bruno!
            MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
            DESIGNfromWITHIN, MPThemes and Any Screen Size
            Follow me on Twitter | Read my blog | My code on GitHub
            • 4172
            • 5,888 Posts
            try something like that, untested:

            [[migxLoopCollection?
            &classname=`modResource`
            &joins=`[{"alias":"Image","classname":"modTemplateVarResource","on":"contentid=modResource.id and tmplvarid=TheIDofYourTV"}]`
            &where=`{"parent":"[[*id]]"}`
            &tpl=`gallery_row_tpl`
            ]]


            <img src="assets/gallery/[[+alias]]/[[+Image_value]]" alt="[[+pagetitle]]">
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 29597 ☆ A M B ☆
              • 350 Posts
              So the images work now, but if I add phpthumbof it does not make the images smaller.
              I guess this is becouse of the &processTVs=`0` and &prepareTVs=`0`.

              However if I set &processTVs=`1` and &prepareTVs=`1` the image path is wrong...

              The Tpl.
              <img src="assets/gallery/[[+alias]]/[[+overzichtafbeelding:phpthumbof=`w=752&h=400&zc=1`]]" alt="[[+pagetitle]]">
              
                MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
                DESIGNfromWITHIN, MPThemes and Any Screen Size
                Follow me on Twitter | Read my blog | My code on GitHub
              • discuss.answer
                • 4172
                • 5,888 Posts
                try:

                [[!phpthumbof? &input=`assets/gallery/[[+alias]]/[[+overzichtafbeelding]]` &options=`w=752&h=400&zc=1`]]
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 29597 ☆ A M B ☆
                  • 350 Posts
                  Yes, that works! Thanks so much.
                  Buying you a beer now...
                    MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
                    DESIGNfromWITHIN, MPThemes and Any Screen Size
                    Follow me on Twitter | Read my blog | My code on GitHub