ZenphotoCMS Forum
Problem with thumbnails size - 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: Problem with thumbnails size (/thread-3936.html)



Problem with thumbnails size - binocle - 2008-10-25

Hi

First, I'm french and my english is really poor so excuse me in advance ;-)

So,
For the gallery of my website I use the new 1.2.1 version of zenhoto

In this gallery, I’ve got several picture sizes and lots of panoramics.
.
The default thumbnails size and scale is 120, so the size of my common pictures thumbmails is 120180 or 180120.

But I’ve got a problem with the proportions of my panoramic pictures. Indeed, a panoramic of 120px high is arround 400px in width and I would like them to be displayed in a max witdh format of 180px.

So I would like to know if it is possible to configure the MAXIMUM dimension of thumbnails or to resize by the longest size rather than by the shortest size like now.

I have seen a website where thumbnails are configured as I would: http://www.boutsdeplanete.com/portfolio/page/search/le_d%C3%A9sert

Could you tell me how I can do this ?

Thanks for your answer
Sincerely




Problem with thumbnails size - acrylian - 2008-10-26

You need to use the nightly build (they are in 1.2.1 already but with bugs) and use these functions:
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetCustomAlbumThumbMaxSpace
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintCustomAlbumThumbMaxSpace
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetCustomSizedImageMaxSpace
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintCustomSizedImageMaxHeight




Problem with thumbnails size - olihar - 2008-10-26

is it good to recommend something that does not currently work, I know you said it has bugs.

There are no news on the CustomAlbumThumbMaxSpace are there?




Problem with thumbnails size - acrylian - 2008-10-26

Yes, that's why I recommended the latest nightly..:-) sbillard has helped out with that recently [svn 2773] and hopefully solved the remaining bugs.

Btw, if you are really waiting for something you could also check here yourself what has been done:
http://www.zenphoto.org/trac/log/trunk




Problem with thumbnails size - binocle - 2008-10-26

Thanks, but I've find the solution this morning, I've use the function printCustomSizedImageMaxSpace, but not the nightly.

It looks to work very well.

Thanks:-)




Problem with thumbnails size - olihar - 2008-10-27

Hmm, I thought I was up to date on changes.

I put up [2795] and I am getting no change what so ever, the same identical bug.

I have changed so much.. I just want to make 100% sure I am using the right code.

">




Problem with thumbnails size - olihar - 2008-10-27

I changed to

">

and for some odd reason it seems to work better... but its still not 100% and its kind of random as before.

EDIT: and it seems the problem is now Only on vertical photos. As for as my testing has gone anyways. Not like just a random every image as before.




Problem with thumbnails size - acrylian - 2008-10-27

You use the right code... Ahrg, these functions are really starting to cause headache...:-(

I don't see the connection the the quotes around the title... We reworked that function completly twice...I am running out of ideas.. Maybe you could try to help by looking at the functions itself?




Problem with thumbnails size - olihar - 2008-10-27

I have played around with the code in the template-functions.php for almost 2 hours now.. Always this random thumb error. I recon this has to be somewhere else then in the function printCustomAlbumThumbMaxSpace

and yeah of course mentioning that the problem is the same with video files as it was before.




Problem with thumbnails size - olihar - 2008-10-27

I think I cracked it.

Change template-functions.php

Line 1309-1323

From

function printCustomAlbumThumbMaxSpace($alt='', $width=NULL, $height=NULL, $class=NULL, $id=NULL) { global $_zp_current_album; $destshape = $width > $height; $albumthumb = $_zp_current_album->getAlbumThumbImage(); $sourceshape = $albumthumb->get('width') > $albumthumb->get('height'); if ($sourceshape == $destshape) { // the soruce and destination orientations are the same printCustomAlbumThumbImage($alt, min($width, $height), NULL, NULL, NULL, NULL, NULL, NULL, $class, $id); } else{ if ($sourceshape > $destshape) { // landscape to portrait, width is constrained printCustomAlbumThumbImage($alt, NULL, $width, NULL, NULL, NULL, NULL, NULL, $class, $id); } else { // portrait to landscape, height is constrained printCustomAlbumThumbImage($alt, NULL, NULL, $height, NULL, NULL, NULL, NULL, $class, $id); } } }
to

function printCustomAlbumThumbMaxSpace($alt='', $width=NULL, $height=NULL, $class=NULL, $id=NULL) { global $_zp_current_album; $sourcew = $width > $height; $sourceh = $height > $width; if ($sourcew == $sourceh) { // the soruce and destination orientations are the same printCustomAlbumThumbImage($alt, min($width, $height), NULL, NULL, NULL, NULL, NULL, NULL, $class, $id); } else{ if ($sourcew > $sourceh) { // landscape to portrait, width is constrained printCustomAlbumThumbImage($alt, NULL, $width, NULL, NULL, NULL, NULL, NULL, $class, $id); } else { // portrait to landscape, height is constrained printCustomAlbumThumbImage($alt, NULL, NULL, $height, NULL, NULL, NULL, NULL, $class, $id); } } }
EDIT: did some minor tweaks.
EDIT: and of course global $_zp_current_album; shouldn't be needed there any more as well
EDIT: Can it really be this easy?




Problem with thumbnails size - acrylian - 2008-10-27

Oh great, thanks for looking into that! We will take a further look at that. But if it works for you that's great.

Sorry that I forgot to mention about the missing videothumb, we have that not in there because they are a little separate from the normal (also there are some issue with that in general because of the mentioned custom crop feature). I promise they will return once the general function is approved..:-)




Problem with thumbnails size - olihar - 2008-10-27

Great. Now its only the video thumb as stated above and the Encoding for International Characters, then I am all set for the time being. I am looking forward to hear about the charset as that is the only thing holding putting the web pages up for the public.