We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26401
    • 247 Posts
    I have a setup with a second context that has one resource and acts as sort of the landing page where I have two similar home pages

    while this works for the most part, I've been struggling to get the phpthumb working. I've looked through this thread
    https://forums.modx.com/thread/?thread=39183&page=7
    and applied the info there, but was not able to get it running without issues (some images were fixed, but not all)

    I've updated to pThumb and it did not resolve the issue, so I started digging deeper and found that the input to the snippet was already missing the media folder location.

    Once I've figured that out, I've found a way to hack my way around it by adding a custom setting tv_thumb_basepath that is only set in the second context

    and then I use this chunk as my tpl
    [[phpthumbof?input=`[[++tv_thumb_basepath]][[+tv.thumb]]`&`w=125&h=130&bg=FFFFFF`]]


    is there another way to get around this?

    Hope this helps someone who's coming up against the same issue

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

    • discuss.answer
      • 16899
      • 284 Posts
      Quote from: scorche at Dec 03, 2015, 12:16 AM
      I have a setup with a second context that has one resource and acts as sort of the landing page where I have two similar home pages

      while this works for the most part, I've been struggling to get the phpthumb working. I've looked through this thread
      https://forums.modx.com/thread/?thread=39183&page=7
      and applied the info there, but was not able to get it running without issues (some images were fixed, but not all)

      I've updated to pThumb and it did not resolve the issue, so I started digging deeper and found that the input to the snippet was already missing the media folder location.

      Once I've figured that out, I've found a way to hack my way around it by adding a custom setting tv_thumb_basepath that is only set in the second context

      and then I use this chunk as my tpl
      [[phpthumbof?input=`[[++tv_thumb_basepath]][[+tv.thumb]]`&`w=125&h=130&bg=FFFFFF`]]


      is there another way to get around this?

      Hope this helps someone who's coming up against the same issue

      Hi

      You forgot & before input. smiley Ahh... and put the snippet uncached!!!

      [[!phpthumbof? &input=`[[++tv_thumb_basepath]][[+tv.thumb]]`&`w=125&h=130&bg=FFFFFF`]]
        • 26401
        • 247 Posts
        Quote from: legues at Dec 03, 2015, 07:45 AM

        You forgot & before input. smiley Ahh... and put the snippet uncached!!!

        [[!phpthumbof? &input=`[[++tv_thumb_basepath]][[+tv.thumb]]`&`w=125&h=130&bg=FFFFFF`]]

        Why should the snippet be uncached? I think caching is fine, because it gets cached based on the input, no?

        I did use ?input instead of &input, I'm surprised that it worked though
          • 16899
          • 284 Posts
          Quote from: scorche at Dec 03, 2015, 08:02 PM
          Quote from: legues at Dec 03, 2015, 07:45 AM

          You forgot & before input. smiley Ahh... and put the snippet uncached!!!

          [[!phpthumbof? &input=`[[++tv_thumb_basepath]][[+tv.thumb]]`&`w=125&h=130&bg=FFFFFF`]]

          Why should the snippet be uncached? I think caching is fine, because it gets cached based on the input, no?

          I did use ?input instead of &input, I'm surprised that it worked though

          If the snippet isn´t cached, somethimes could not replicate the most updated information until you clean the system cache. As good practice, i always declare all the snippets uncached!!!! And never forget snippets and their parameters should always be like this
          [[!snippetName? &parameter=`value` &parameter2=`value`]]


          And now, enjoy Modx, the best CMS in the world!!!! smiley