ZenphotoCMS Forum
Max height and max width for thumbs - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Max height and max width for thumbs (/thread-2878.html)



Max height and max width for thumbs - jackdaw - 2008-05-14

I have been reading all kinds of posts about this, including the info about the printCustomSizedImage(getImageTitle(), null, null, 120) etc., but I don't quite understand it yet.

In my albums I will have images (drawings, photographs) in all kinds of dimensions, from square to panorama.

I would like to have a max height for all the thumbs (120, so they can float nicely), but also within a max width. That means most images will actually be 120px high, but a panorama picture would become less than that because it needs to fit inside that max width.

What would be the correct parameters for printCustomSizedImage to achieve this?




Max height and max width for thumbs - acrylian - 2008-05-14

I beleive there are no parameters to do that with one function. You would most likely have to do that with a if else construct like this (no working example of course!):
`if(landscape image) {

one size

} else {

other size

}`

Please see the functons guide, we have functions to get the width etc (I don't have the exact names in mind right now).




Max height and max width for thumbs - jackdaw - 2008-05-14

I've tried this

if (isLandscape()) { printCustomSizedImage(getImageTitle(), null, 190, null); } else { printCustomSizedImage(getImageTitle(), null, null, 120); }

and the result is promising, but as you can see the sizes are not exactly right. Middle bottom is too short, and bottom right is a bit too high.

screenshot

Any idea if this can be done better? Can't think of anything else .




Max height and max width for thumbs - jackdaw - 2008-05-14

Ah... forget it. I don't even like how it looks this way , with the captions going up and down...
I think I'll put those panorama's inside another album with a custom theme, and the rest I'll keep to a fixed height...

Hope you weren't thinking about a solution yet :=)




Max height and max width for thumbs - acrylian - 2008-05-15

Well, I personally like cropped thumbs best, because it looks cleaner and less fuzz than changing sizes. But anyway I would have suggested now to make a custom function for thumbs out of this template function (it was done for bascially the same but for the bigger sized image on image.php):
`function printCustomSizedImageMaxHeight($maxheight) {

if (getFullWidth() === getFullHeight() OR getDefaultHeight() > $maxheight) {

    printCustomSizedImage(getImageTitle(), null, null, $maxheight, null, null, null, null, null, null);

} else {

    printDefaultSizedImage(getImageTitle());

}

}`

This actually worked the last time and it even takes care of square image that can become to big. Maybe you want to give that a try.