We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39501
    • 163 Posts
    I have 3 different types of images that need resizing.

    Landscape, Portrait and Square.

    I'm using phpthumb on a portfolio page quite effectively (because the columns are a fixed width): For example:
    [[+image:phpthumbof=`w=300&zc=1`]]

    However when you click through from an image on the portfolio page, I want the images to display larger.

    I want to use some logic like:

    • if landscape image > no bigger than width 'x', height 'auto'
    • if square image > no bigger than width 'x', height 'auto'
    • if portrait image > no bigger than height 'x', height 'auto'

    I've been reading through:
    http://phpthumb.sourceforge.net/demo/docs/phpthumb.readme.txt
    http://rtfm.modx.com/display/ADDON/phpThumbOf

    However, the parameters in the text file don't seem to work as indented:
    [[+image:phpthumbof=`&hp=500&wl=750&ws=500`]]

    Square & portrait images have white space included in the image left and right, as if the rule above is conflicting.

    Any experience with Phpthumb or advice?

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

    [ed. note: jonleverrier last edited this post 11 years, 3 months ago.]
      • 38723
      • 165 Posts
      Do you need to include &zc=something as well as setting the portrait height/landscape width.

      Are the portrait images all uniform size, ie - can you set &pw= on them? Same goes for landscape height, if portrait height is 500, then landscape height max is 500 too?

      I'll try out on an install and see what I can get.
        • 39501
        • 163 Posts
        Hey pdincubus - I don't really want to zoom crop the images.

        Quick explanations to the values in my call:
        [[+image:phpthumbof=`&hp=500&wl=750&ws=500`]]

        hp = max height of portrait images
        wl = max width of landscape images
        ws = max width of square images

        I've found a temporary solution by just setting a fixed height (no width), but the portrait and square images suffer a little because of this.

        • discuss.answer
          • 39501
          • 163 Posts
          Actually looks like a bug with phpthumb:
          https://github.com/splittingred/phpThumbOf/issues/35