Member
Member
minutepapillon   2010-07-31, 22:18
#1

Hi everyone,
I noticed that in my zpgalleriffic theme, zenphoto resizes photos if a logical condition is true (involving w, h, or max(h,w) )
But there is no way To set a MaxWidth different from the maxHeight to do this :
Resize picts if width > 900 or height > 500
So I tried to find in the code where the native logical conditions where implemented ... but I can't find it.
Do you know wich file and line should be modified ?
Thanks !!

Member
Member
gjr   2010-08-01, 01:49
#2

top of header.php. It will break the layout if you change it without changing a lot of css and js code as well...

Member
Member
minutepapillon   2010-08-01, 13:13
#3

Hi GJR !
Right, that's why I changed some css. See :
http://www.nicolasguionnet.com/zgal/art/nature/marais/
The space reserved for images is not square so the resizing should occur when the picture is over 900 (width) OR over 500 (height).
It should be an intelligent resize so that the picture is a large as possible but fits in the rectangle container (a simple algo does the job ... but where can I insert it in the BIG MACHINE ??)

Top of the header, only one value can be changed, it's the max for width AND height, which is not convenient in this case. (It's ok when the pict container is square ... but I produce a lot of panorama picts ... width >> height)
In fact, square container are rare (screens aren't square !) ... so I think that this type of resize is interesting to consider ...
Thanks for any clue,
Nicolas
PS: By the way the colorbox click is just implemented on my site (thanks !)

Member
Member
gjr   2010-08-01, 15:51
#4

I wonder if the the getMaxSpaceContainer, printCustomSizedImageMaxSpace would fit your needs?

http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintCustomSizedImageMaxSpace

Member
Member
minutepapillon   2010-08-01, 16:22
#5

Thanks once again Gjr,
It would probably solve the problem but I couldn't find where to inject anything in the code.
As you know, in the header, size is defined by :
setOption('image_size','500',false);
The code resizes any image bigger than that, that behaviour should be removed and replaced. I tried to follow the flow of that data, to reach the line of code similar to :
If width or height > image_size then resize
... to replace it by one line of code that would do the job.
I couldn't find it ...
Any clue ?

Member
Member
gjr   2010-08-01, 16:40
#6

line 70 of album.php:

replace the getDefaultSizedImage() with the appropriate get MAX size function.

Also will need to change this in search.php

This will also override the size in header.php

Member
Member
minutepapillon   2010-08-01, 19:59
#7

Wao ... works perfectly ... Thank you so much ...
It's easier when you get help ;o)
Well, in search.php and album.php I replaced this :
getDefaultSizedImage()
by this
getCustomSizedImageMaxSpace( 900, 500 )
It is not an elegant way, I know, but I guess, if I wanted to add a :
setOption('my_image_width','900',false);
setOption('my_image_height','900',false);
... i would need to insert the two new variables in the database, wouldn't I ?
That's probably more complex ...
Thanks again for the solving of my two problems of the day.
Bye, Good luck
Nicolas

Administrator
Administrator
acrylian   2010-08-02, 08:21
#8

setOption('my_image_width','900',false); setOption('my_image_height','900',false);
[i]... i would need to insert the two new variables in the database, wouldn't I ?[/i]
If you change the false to true the option will be set in the databse, otherwise it is just temporarily on that page.

The maxspace function only work with direct parameter settings and you used it in the correct and intended way. No need to put that into the database if you set it on the theme directly anyway.

Member
Member
minutepapillon   2010-08-02, 13:09
#9

Thanks Acrilian,
"No need to put that into the database if you set it on the theme directly anyway. "
yes, but it is set in two different places (album & search) ... better if it's set in only one line, as you know ...

Do you mean that this doesn't work ?

setOption('my_image_width','900',false);
setOption('my_image_height','900',false);

... getCustomSizedImageMaxSpace( getOption('my_image_width' , getOption('my_image_height') ) ...

Maybe I am overPerfecting the stuff ... as it already works perfectly.
That's a developper's mania ... You know that ! ;o)
Thanks to you guys for answering so fast and so efficiently !!!

Administrator
Administrator
acrylian   2010-08-02, 13:19
#10

Please see the doc: http://www.zenphoto.org/documentation/functions/_functions-basic.php.html#functionsetOption

You you could just use getCustomSizedImageMaxSpace( 900, 900 ) directly, virtually the same.

Member
Member
minutepapillon   2010-08-02, 14:13
#11

Thanks !!

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.