Resize picts if width > 900 or height > 500

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 !!

Comments

  • gjr Member
    top of header.php. It will break the layout if you change it without changing a lot of css and js code as well...
  • 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 !)
  • gjr Member
    I wonder if the the getMaxSpaceContainer, printCustomSizedImageMaxSpace would fit your needs?

    http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintCustomSizedImageMaxSpace
  • 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 ?
  • gjr Member
    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
  • 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
  • acrylian Administrator, Developer
    `
    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 ?
    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.
  • 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 !!!
  • acrylian Administrator, Developer
    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.
  • Thanks !!
Sign In or Register to comment.