On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I've used phpThumbOf for years with great ease, but now I can't wrap my head around something easy (at least in concept).

    I have an original image that's 780x439 and I'd like to resize/crop/cut it down to 275x413. So the challenge here is that I'm going from a landscape orientation to portrait one. The best I've gotten so far is a portrait thumbnail that's 165x220. So the landscape-to-portrait crop/cut is working, but the dimensions are off. I've tried a bunch of stuff, but I can't get it to work.

    Here's the getResources tpl code containing the phpThumbOf output modifier:
    [[[[+idx:is=`1`:then=`$wrapImgThumb? &src=`+tv.Poster` &thumbOpts=`w=275&h=413&zc=1` &width=`275` &alt=`+pagetitle``]]]]

    Here's the $wrapImgThumb chunk:
    <img src="[[[[+src]]:phpthumbof=`[[+thumbOpts]]`]]" width="[[+width]]" class="img-responsive" alt="[[+alt]]">

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

      A MODx Fanatic
    • discuss.answer
      Turns out I did everything right. The issue is with image+ TV, that wasn't playing nice. Got rid of it,reverted back to basic image TVs and I'm smiling again!
        A MODx Fanatic
      • Could you tell where Image+ does not play nice? Maybe there is an issue that could be solved.
        • Hey Jako, after further investigation, it appears that the issue with phpThumbOf was caused by the TV's target width and height. I had 390 for the width and 220 for the height. This is why my thumbnails never exceeded these dimensions no matter the value I set in the width and height properties.

          Once I determined this, I wanted to remove those settings so I could have more flexibility when sizing the thumbnails, but no luck. Image+ was no longer available as input or output property for my TV. I should note that I upgraded MODX to 2.4.0 from 2.3.5 and Image+ to Imageplus 2.4.0-beta-2. I thought this, along with cache clearing, would suffice to get things rolling again, but boy was I wrong! Tried as I might, I couldn't get Image+ to appear in the TV properties again. I uninstalled the beta-2 and reverted back to 2.3.4, but nothing. I read in Github that MODX 2.4.0 may have something to do with this.

          I'd like to say that Image+ TV is an awesome extra and I couldn't thank you enough for the great work. I'm waiting for its next release to take it for a spin again. I'm sorry for previously blaming it for the entirety of my problem.
            A MODx Fanatic
          • That missing Image+ output properties are caused by an 2.4.0 issue. Solved by this: https://github.com/modxcms/revolution/pull/12635/files
            • You could use the ImagePlus snippet as workaround at the moment.
              • Thanks for the update Jako. I'll try the workaround.
                  A MODx Fanatic