We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32678
    • 290 Posts
    I’m exploring the potential for using Ditto as a way to create an image gallery by aggregating thumbnails of images associated to pages within a container resource. I know there are several gallery snippets, but none suit my needs.

    Is it possible to use Ditto to aggregate images in this manner?

    Thanks

    **This was really simple once I dug into the Ditto documentation. Awesome snippet.
    • Yes, you can do that using image TVs and having the TV in the Ditto tpl. I have a similar situation where I want full-sized images in the individual page, but thumbnails in the listing. Rather than fuss around with making thumbnails and linking to them, I use the MiniPhoto snippet in my Ditto tpl, and I can use the same TV in my individual page content.
      <img src="[[MiniPhoto? &file=`[+tvphoto+]` &width=`108` &height=`81`]]" width="108" height="81" alt="" class="photo left" />
        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
        • 32678
        • 290 Posts
        Awesome. Thanks!
          • 32678
          • 290 Posts
          Susan, hoping you can take a moment to provide troubleshooting tips for the set-up you described. Mine mimics your recommendation. I have a gallery page with a Ditto call:

          [tt][[Ditto?&tpl=`subGalThumb`&display=`all`][/tt]]

          referencing a chunk that contains the MiniPhoto snippet and placeholder for a TV named "imagePageImage":

          [tt]<img src="[[MiniPhoto? &file=`[+tvimagePageImage+]` &dir=`mini` &width=`250` &height=`100`]]" width="250" height="100" alt="[+tvimageName+] />[/tt]

          The rendered HTML contains the <img> tags, and the number returned accurately corresponds to the number of child resources the Ditto call references, but no value is returned:

          <div id="subgallery">

          [tt]<img src="" width="250" height="100" alt="White River Valley & Mount Rainier" /><img src="" width="250" height="100" alt="MODx Logo" /><img src="" width="250" height="100"
          alt="First Sunrise, Barbados" />[/tt]

          </div> <!-- end subgallery -->

          The Ditto call without MiniPhoto works, so the issue is with the snippet. I copied the PHP into the snippet carefully and doublechecked that everything made it, so no issues there. When I first tested this, I was using PHP 5.3.2 and got a parse error about a deprecated function. Switching to 5.2.13 resolved that.

          The only thing that maybe plays a role here is a possible conflict between MAC OS X’s libjpeg and the one that’s included with MAMP. I posted about this issue here: http://modxcms.com/forums/index.php/topic,50865.msg295830.html#msg295830. From what I read on the MAMP forum, this issue was prevalent with earlier versions of the library. I have not seen this issue posted about in the MODx forum for some time, which seems to substantiate that its not a current issue. I have received no responses to that post, unfortunately, so the issue is unresolved, and I’m not even sure that I’m on the right track regarding the potential conflict.

          Any thoughts on this? This image issue has become a major hiccup to my project so any support you can provide is greatly appreciated.


            • 36592
            • 970 Posts
            What happens if you change
            [[MiniPhoto? ...]]

            to
            [!MiniPhoto? ...!]

            • I don’t know what to say, I just put it in as it suggested in the comments/documentation at the beginning of the snippet, and it worked. Maybe the Ditto call needs to be uncached? Is "tvimagePageImage" the actual name of the image TV?
              *For example with Ditto:
              *<img src="[[MiniPhoto? &file=`[+tvphoto+]` &width=`108` &height=`81`]]" width="108" height="81" alt="" class="photo left" />
              *
              *Where tvphoto is tv parameter (photo) for image.
                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
                • 32678
                • 290 Posts
                I’m using ModX 1.0.4. I was using MAMP as the dev enviro but kept experience inexplicable behavior with a handful of snippets, including MaxiGallery, PreviousNextLast, MiniPhoto, and so on. This despite the ability to switch between a couple versions of PHP. Since creating this thread, I’ve switched to XAMPP and so far, no issues at all.

                Thanks for your responses!!
                  • 16430
                  • 217 Posts
                  I am recieving modx parse error with miniphoto snippet (using php 5.3.x) any solution??