We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40846
    • 13 Posts
    Magic Creations Reply #1, 13 years ago
    Hi:
    I'm working locally with MODX revo 2.2.9 and trying the phpThumbsOF.
    In my machine there's LAMP environment with php 5.4, GD2 and ImageMagick
    my call is:
    <img class="img-front" src="[[+tv.img_frontTV:phpthumbof=`
    w=263
    &h=436
    &f=png
    &fltr[]=ric|110|200
    &fltr[]=rot|15|006699
    `]]" alt="dot1" width="263" height="436" />

    Everything works, except the rot filter:

    if I replace the line with the rot filter by a line invoking the old command ra:
    &ra=15
    Then the rotation works but it doesn't get along with the ric filter.
    Here's the result:

    I replaced phpThumbOF with pThumb but still the same.
    Use Resize is set to No as when it's used, it ignores many Filters, ric between them.
    Could anybody find what I'm doing wrong?
    Thanks,
    Abner

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

      • 35150 ☆ A M B ☆
      • 191 Posts
      Quote from: magic_creations at Sep 09, 2013, 09:56 PM

      Then the rotation works but it doesn't get along with the ric filter.

      Hmm, sounds like it might be a bug with phpThumb. phpThumbOf and pThumb just get things ready, then pass it off to phpThumb for the real work. I've never used either of these filters, so I can't say much about them.
      phpThumb is rather old; it could be that it works properly with PHP 4.X or such, but not 5.4. Also, have you tried taking the whitespace out and running all the options together? (`w=263&h=436&f=png&fltr[]=ric|110|200&fltr[]=rot|15|006699`) That probably won't help any, but it's easy to try...

      If you're using pThumb, you can do this:
      <img class="img-front" src="[[phpthumbof?
          &input=`[[+tv.img_frontTV]]`
          &options=`w=263&h=436&f=png&fltr[]=ric|110|200&fltr[]=rot|15|006699`
          &debug=`1`
      ]]" alt="dot1" width="263" height="436" />

      then look through the phpThumb debug messages in the MODX error log for clues.

      If you really want to test it, you can install phpThumb and try it directly, without phpThumbOf, pThumb, or MODX in the middle.

      You could also get the same effect with CSS, which is what I'd do. IE8 will just see a normal photo, but anybody still using IE8 shouldn't be too picky about stuff like that : ) Other than old IE, support for border-radius and transform is quite broad with the proper vendor prefixes.
        Extras :: pThumb • Resizer • imageSlim • setPlaceholders
        • 40846
        • 13 Posts
        Magic Creations Reply #3, 13 years ago
        Quote from: jgrant at Sep 10, 2013, 12:04 AM

        phpThumb is rather old; it could be that it works properly with PHP 4.X or such, but not 5.4. Also, have you tried taking the whitespace out and running all the options together? (`w=263&h=436&f=png&fltr[]=ric|110|200&fltr[]=rot|15|006699`) That probably won't help any, but it's easy to try...
        I hadn't thought about the php versionor MODX or phpThumbOf getting in the middle, as I saw this working in Belafonte's Blog(http://www.belafontecode.com/image-manipulation-with-phpthumbof-in-modx-revolution/) with modx Revo so I guess php v5.2+...
        My first try has been without whitespaces and a long line for the options. but then I switched to this format so I could better debug the code...

        Quote from: jgrant at Sep 10, 2013, 12:04 AM

        You could also get the same effect with CSS, which is what I'd do.
        Those pictures come from the end user who uploads 3 different images together with an article. Then, after resizing them, they're used in a slider who needs the images with a specific size. You know you can't ask the user to resize the image just as it's needed, with the proper aspect ratio. That's what I prefer about this preprocess, it works no matter the size of the picture uploaded by the user, and if he just uploads his 3MB picture from his camera, you don't have to download such a monster...
        Thanks, I may try a mixed solution between pThumb to resize the image and css to rotate it if needed.

        regards,
        Abner

        ps,
        a note aside about caching:
        Before using phpThumb, all this preprocess I handled it with GIMP and then uploaded the image as png in a TV. I had 4 articles using the same image sca_front.png
        When I decided to use phpThumbOf, I changed the TV in one of the articles to use the same image uploaded as jpg (sca_front.jpg) without any of the processing. With phpThumbOf, with the option &f=png, the cache filename was alwas the same, no matter of the extension of the input file. With pThumb, this was corrected.
        • discuss.answer
          • 35150 ☆ A M B ☆
          • 191 Posts
          Quote from: magic_creations at Sep 10, 2013, 01:08 PM

          Those pictures come from the end user who uploads 3 different images together with an article. Then, after resizing them, they're used in a slider who needs the images with a specific size. You know you can't ask the user to resize the image just as it's needed, with the proper aspect ratio.

          Yes you're right; I'd definitely use pThumb to generate the proper size images from what the client uploads. You could use phpThumb's ric filter to make it an oval, or CSS border-radius (border-radius:100%) on the front end. Then the rotation you can do with transform:rotate(15deg); Just be sure to use all the necessary vendor prefixes (-webkit-transform, -moz-transform, -ms-transform, etc.). IE8 gets a plain straight rectangular image, but no IE8 users notice stuff like that anyway.

          With phpThumbOf, with the option &f=png, the cache filename was alwas the same, no matter of the extension of the input file. With pThumb, this was corrected.

          That's good to hear! I'm glad at least one thing was fixed : )
            Extras :: pThumb • Resizer • imageSlim • setPlaceholders
            • 40846
            • 13 Posts
            Magic Creations Reply #5, 13 years ago
            Hi! Sorry for not getting back to you to thank you again. I had in mind using a mixed solution like the one you suggested (php for resize and css to rotate) although I was expecting something much more complicated than it is. Thanks for pointing me in the right directio with transform:
            firefox understands transform (as does Opera) and doesn't need any vendor prefix (so -moz-transform:rotate() doesn't exist -you use just the standard expression transform:rotate)
              • 35150 ☆ A M B ☆
              • 191 Posts
              Thanks for reporting back. I'm glad you've got the problem worked out!

              Yes, CSS can do a lot of nifty stuff now and I think this makes some of phpThumb's filters obsolete, or at least not essential. That's one of the reasons I left them out of Resizer (that and I didn't want to do all the work : )

              firefox understands transform (as does Opera) and doesn't need any vendor prefix (so -moz-transform:rotate() doesn't exist -you use just the standard expression transform:rotate)

              Oh, you're right. Firefox dropped the -moz prefix a long time ago for 2D transforms. I always have Compass deal with vendor prefixes, so I should have checked to make sure what's really needed these days. Can I use... is a brilliant site for checking browser support and vendor prefixes for stuff like that.
                Extras :: pThumb • Resizer • imageSlim • setPlaceholders