We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I am using the following call in my chunk [[+image:phpthumbof=`w=410&h=350&q=90`]]

    I am not setting the zoom crop and on cloud it takes the image and sets the height to fit 350 pixels high. If the width is then too narrow to fill the 410 pixels, it then fills in the extra space with white. (see screenshot). This is the desired effect.

    However on my Domain Factory server (imagemagick is installed) phpthumbof stretches the width to fill the remaining space. Phpthumbof works perfectly when I set the zc=1, but this is not what I need.

    Anyone have an idea what could be different or how I can manipulate it to the way I want?

    The site is running on PHP 5.2.17
      Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
    • I'm no graphics expert by any stretch of the imagination, but I have always thought that if you specified both width and height, the image would be stretched as necessary to fit the specified dimensions. If you omit one or the other dimension, then the one specified is obeyed, filling in with white as necessary.
        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
      • Take a look through all the phpthumb parameters http://phpthumb.sourceforge.net/demo/docs/phpthumb.readme.txt. It sounds like the defaults on the two servers are different, like iar=1 on Domain Factory.
          Extras :: pThumbResizerimageSlimsetPlaceholders
        • In the phpmythumbof documentation it states this:
          Thumbnails will be scaled proportionately to fit in a
          box of at most (width * height) pixels
          (unless "iar" is set)
          So I thought it should work as it does on cloud... it takes the width or height that is the highest value, checks the w and h settings and proportionately fits it in the assigned box... any extra space is filled with white as standard setting...
            Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
          • I tried to activate iar to no luck:
            <li><img src="[[+image:phpthumbof=`w=410&h=350&iar=1`]]" alt="[[+title]]" /></li>

            according to here: http://www.belafontecode.com/image-manipulation-with-phpthumbof-in-modx-revolution/

            if you use just the w and h parameters without giving a zc parameter, then it should act as I expected on the cloud. It fills in the empty space with white.

            On Domain Factory, however there seems to be no effect. I also upgraded to PHP version 5.3.19, but that made no difference.
              Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
            • I think you want iar off, actually (iar=0). The problem is that it's ignoring the image's aspect ratio and stretching it to fit your dimensions. You might have a look at the far (force aspect ratio) option and throw far=C in there for good measure.
                Extras :: pThumbResizerimageSlimsetPlaceholders
              • What a tricky bugger...
                <li><img src="[[+image:phpthumbof=`w=410&h=350&iar=0&far=C`]]" alt="[[+title]]" /></li>
                This yields absolutely no difference. I also emptied the cache on modx and no change.
                  Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
                • What is a good way to test for this? I can see that the source's link to assets/components/phpthumbof/cache is correct.. the images are being created. But it is like it is not processing properly unless it has a zc value of 1.
                    Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
                  • I am wondering if it has something to do with the fact that my template is running through migx. Maybe that is where it is hitting the wall..
                      Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
                    • Strangely I copied my MIGX call
                      [[!getImageList? &docid=`21` &tvname=`galerie.migx` &tpl=`aboutGalleryTpl`]]
                      and pasted it into a resource content and saved it. On this resource it then behaved correctly... and strangely then and suddenly, all of my instances on the website where I use this started working.

                      I wonder if there wasn't somethign strange in the cache preventing it from working before..? I have no idea...
                        Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.