ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

phpThumbs aspect ratio problem - help?

July 06, 2007 7:01pm

Subscribe [0]
  • #1 / Jul 06, 2007 7:01pm

    jducka1

    12 posts

    I have just installed phpThumbs and I cannot get the thumbnails to display at my desired dimensions.  I want all images, portrait and landscape, to have a width of 120 pixels, and to maintain the aspect ratio of the source file.  When I write:

    phpThumb.php?src={photos_before}&w=120

    It sets the width at 120, but the height displayed is the source image height (often quite huge) ... so the image is totally distorted.  I am racking my brain and can’t figure out what I’m doing wrong? 

    I’m running EE 1.5.2, and Mark Huot’s File Extension.  The images are uploaded as “files” attached to a blog entry.  I’m using EngineHosting.

  • #2 / Jul 06, 2007 9:54pm

    Stephen Lewis

    466 posts

    Hi there,

    According to the phpThumb documentation, w and h set the *maximum* width of the thumbnail image, and “will be scaled proportionately to fit in a box of at most (width * height) pixels (unless “iar” is set)”. Based on that, have you tried setting the height to arbitrarily large number? For example:

    phpThumb.php?src={photos_before}&w=120&h=1000

    Cheers
    Stephen

  • #3 / Jul 07, 2007 2:21am

    Luke Stevens

    80 posts

    phpThumb should be keeping the aspect ratio by default - that’s what happens in the demos with the same usage as you describe. Does your custom field contain the full http://www... domain, or just the directory/filename.jpg of the images? If it’s the full url, try just using the directory/filename.jpg method. Also, do you have a live example?

  • #4 / Jul 07, 2007 2:30am

    jducka1

    12 posts

    I’m using relative paths.  I am not using any custom fields at this point.  For now I’m just trying to get the thumbnails to generate correctly.  Here is what I get:

    http://davis.pmhclients.com/index.php/pages/portfolio/

    You can view source to see the dimensions that I am wanting the image to have.  I have tried every combination of parameters that I can think of.  In the latest version I am trying to use the wp, wl, hp, hl parameters, but that isn’t working either.  Pretty much no matter what I use I get these strange tall images.  (e.g., 75 px wide x 300 px tall).

  • #5 / Jul 07, 2007 2:41am

    Luke Stevens

    80 posts

    What happens if you remove the spaces in your file names (or replace with dashes/underscores)? I experimented on the logo gif (no spaces) and it kept the aspect ratio there.

  • #6 / Jul 07, 2007 2:52am

    jducka1

    12 posts

    I can’t believe I didn’t think of that—it looks like that was the problem.  Thanks for your help!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases