We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8454
    • 55 Posts
    Hi all,
    Has anyone got a quick’n’dirty solution for accessing the thumbnails generated by fckeditor/the file manager?
    I would like to replace large template variable images with their equivalent .thumb_-file in selected Ditto calls.

    I have:
    <img src="[+mainimage+]"/>
    where mainimage is a custom image TV. And would like:
    <img src="[+the thumbnail corresponding to mainimage+]"/>


    For now, I would like to avoid any solution with additional thumbnail generation such as gallery add-ons, or new TV:s where the user has to do more editing than just inserting the hires mainimage.

    Thanks for reading!
      • 1122
      • 209 Posts
      The above post is the most simple and, at the same time, most clever idea that I have read within recent weeks/months -- using of system thumbnails that are anyway generated whenever somebody uploads image with fck editor.

      I tried to keep my thing as simple (and clean) as the idea itself -- snippet "get_fck_thumb":
      <?php
      if (isset($image) && file_exists($image)) {
          return (file_exists($thumb = preg_replace('#([^/]+)$#', '.thumb_$1', $image)) ?
              $thumb :
              $image
          );
      }
      ?>
      

      Instead of [+mainimage+] use [[get_fck_thumb? &image=`[+mainimage+]`]]
        • 20413
        • 2,877 Posts
        WoooT! Nice tip!! smiley
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 8454
          • 55 Posts
          Thank you, alik, for your elegant snippet and kind words on my idea. It worked instantly and above expectation.
            • 22369
            • 11 Posts
            Hi Guys,

            I’m a newbee in the modx world, and i think that I’m looking for a similar solution without getting the same results (ie I’m not getting any image URL).

            I’m thinking that I’m missing a part here (maybe pulling in the TV so ditto on the parent page can list them out?)

            I have:

            1. Created a TV for my image - working fine
            2. Added in the snippet
            3. Added this to the chuck (called as the template in Ditto)
            <image src="[[get_fck_thumb? &image=`[+advert-image+]`]]" />

            Placed this ditto call on the container page:
            [!Ditto? &id=`marketplace` &dateFormat=`%d - %b - %Y` &dateSource=`pub_date` &tpl=`marketplace` &parents=`67` &dateFilterDefault=`1`!]

            Any guidence would be very much appreciated.
              • 20413
              • 2,877 Posts
              - Does the ditto call with chunk itself work, does it list documents?
              - Does the snippet
              [[get_fck_thumb? &image=`[*advert-image*]`]]

              work on a page with that TV?
              - Are the thumnails created in the image folder?
                @hawproductions | http://mrhaw.com/

                Infograph: MODX Advanced Install in 7 steps:
                http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                • 22369
                • 11 Posts
                Hi,

                The ditto call works yes
                Thumbnails are being created - yes
                I can also pull the normal large image from the TV through to the Ditto call from within the chunk

                I think the problem is with the snippet.

                I wonder if it has something $image variable within the snippet? Should this variable $image related to the name of my TV (advertImage) in any way? or is this variable a default variable for TV image uploads?

                Thanks for trying to help by the way - much appreciated.
                  • 20413
                  • 2,877 Posts
                  Did you try my change code with change ** instead of ++ on a page
                  just pasting it into the resource content field or in your template?

                  //
                  - Go back to the snippet and look for double ?> ending! That would break it.
                  - Make sure you named the snippet get_fck_thumb
                    @hawproductions | http://mrhaw.com/

                    Infograph: MODX Advanced Install in 7 steps:
                    http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                    Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                    http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                    • 36592
                    • 970 Posts
                    Quote from: oroojo at Nov 04, 2009, 07:57 PM

                    3. Added this to the chuck (called as the template in Ditto)
                    <image src="[[get_fck_thumb? &image=`[+advert-image+]`]]" />
                    <image ...

                    should be
                    <img ...

                      • 22369
                      • 11 Posts
                      Hi,

                      @mrhaw
                      Yes i have tried both of these options in the content of the page to test :

                      [[get_fck_thumb? &image=`[+advertImage+]`]]

                      and

                      [[get_fck_thumb? &image=`[*advertImage*]`]]

                      (Note, I removed the dash of the TV name just to test)

                      I had double checked the snippet name was correct with no spaces etc.

                      @tkfm
                      Hi, sorry yes, I had removed that, but was still not getting the thumb path when viewing the source code