Thumbnail scaling

In the zp-config.php we have this:
`

// Default thumbnail size and scale:

// If $thumb_crop is set to true, then the thumbnail will be a centered portion of the image

// with the given width and height after being resized to $thumb_size (by shortest side).

// Otherwise, it will be the full image resized to $thumb_size (by shortest side).

// NOTE: thumb_crop_width and height should always be less than or equal to thumb_size

`
Shouldn't be scaling by longest side? The thumbs became a mess when scaling this way. At least it should be an option.

Comments

  • trisweb Administrator
    You're right, it should be an option. When I move to a new admin system, I'll make an options panel with a good interface for defining what thumbs should look like by default...
  • `

    // Default thumbnail size and scale:

    // If $thumb_crop is set to true, then the thumbnail will be a centered portion of the image

    // with the given width and height after being resized to $thumb_size (by shortest side).

    // Otherwise, it will be the full image resized to $thumb_size (by shortest side).

    // NOTE: thumb_crop_width and height should always be less than or equal to thumb_size

    `

    I'd need that the thumb is not generated from centered portion, but from top portion. What do I have to edit in i.php to achieve this?

    thanks!
  • trisweb Administrator
    I would edit the theme files, not i.php -- change the image printing function into getCustomThumbURL or something like that. Take a look at the Stoppeddesign theme included with Zenphoto to see how that's done.
  • This thumb scaling by shortest side is a bit of a problem for me too. Does anyone know a hack to get it to work by longest side, maybe change the order of division in the appropriate function?
  • I'm also looking to scale thumbnails by the longest side of the image as well. I'm using 1.1.2. Scaling by the shortest side is giving me some really awkward looking thumbnails... and I don't really like the cropped ones.
  • Is there any chance that there's a "quick fix" for this? I've already tried looking at the code myself... but honestly, math just makes my eyes cross.
  • -pokes at things with a stick-
  • Tak:

    Have you tried Trisweb's suggestion?
  • I've looked at the function "getCustomThumbURL" in the theme Stopdesign - with it I know I can print custom sized thumbs... but how do I get them to scale by the longest side, and not simply crop? I don't want cropped thumbnails, and I'd like them to scale by the longest side, not the shortest. That's the problem I'm having.
  • Thanks for that link. I did the code changes, only it appears to have fixed nothing for me. Do I have to change something specific in my theme as well?

    Gallery URL: http://shriker.ca/archive/design/ *
    * Has two examples of really long thumbnails that I wish were scaled properly.

    Current version ZenPhoto 1.1.3.
    Theme: default

    image display options
    - Image size: 595
    - Images size is longest size: checked
    - Thumb size: 130
    - Crop thumbnails: not checked
    - Crop thumbnail width: blank
    - Crop thumbnail height: blank

    I've also tried clearing my thumbnail cache, but those particular thumbs keep on coming back the same way.
  • try putting in 130 for Crop thumbnail width and Crop thumbnail height
  • That worked. Thanks! :)
  • This may be a related problem...

    I'm trying to get my thumbnails to not be cropped at all, so that the user can preview the entire image as a miniature before clicking it and opening it full size.

    Right now my gallery crops the image to a square in the middle of the image. How do I do this?
  • Reset the "crop Thumbnails" option.
  • I did. No love.

    Here's what I have:

    Image Quality: 100
    Thumbnail Quality: 100
    Image Size: 800
    Images size is longest size: On
    Allow upscale: Off
    Thumb size: 100
    Crop thumbnails: On
    Crop thumbnail width: 100
    Crop thumbnail height: 100

    This is what it looks like:

    http://zerflin.com/ZenPhoto/index.php?album=works
  • If you have crop thumbnails on, they will get cropped. Reset means not checked.
  • It doesn't change anything (I had it off to begin with). See, now it's off and it looks the same: http://zerflin.us/ZenPhoto/index.php?album=works
  • OK, something got screwed up along the way.

    In functions.php in the function `getImageParameters` the first line of code now reads:
    ` $thumb_crop = ('thumb_crop');`
    is should read:
    ` $thumb_crop = getOption('thumb_crop');`

    We will get this fixed in a nightly build shortly.
  • acrylian Administrator, Developer
    By the way: If you don't fill in anything in the fields "Crop thumbnail width" and "Crop thumbnail height" it will work too.
  • Excellente. Thank you both. Both suggestions work (I tried acrylian's suggestion first, then fixed the code).

    Now I have another question... it appears as though the "Thumb size:" checkbox dictates how big the thumbnail is on shortest side... is there a way to make it define the longest size instead?

    Here's how it looks now: http://zerflin.us/ZenPhoto/index.php?album=works
  • acrylian Administrator, Developer
    You could try replacing the imagethumb() function in your theme's image.php. We have a (experimental) function called printCustomSizedImageMaxHeight() that gives you the possibility to set the maximum width with the common size option in the admin and the maximum height within this function. See here for further info: http://www.zenphoto.org/documentation
  • It's just me again. :x All the fixes above work for the 1.1.3 version, but not the newest 1.1.4 build. So my proportionately scaled thumbs are all ugly again. Is there any way to fix things again for 1.1.4?
Sign In or Register to comment.