slideshow custom sizing, attempt #2

I'm still working on creating slideshows with custom sized images.

I'm passing a variable into the slideshow functionality, so this accomplishes the basics. But I've learned that this variable (&imagesize) only controls the width. This is a bummer since portrait photos are then too tall.

So I've been playing around with this line of code:

$img = WEBPATH . '/' . ZENFOLDER . '/i.php?a=' . urlencode($image->album->name) . '&i=' . urlencode($filename) . '&s=' . $imagesize;

If I nix the '&s=' stuff and use '&h=' instead, I can restrict the height of the photos. This is closer, but I've now lost the ability to restrict the width.

I've played around with all of the following, including combinations:
&s=
&w=
&h=

Depending on the combination, cropping kicks in. Not the desired effect.

I simply want a photo to be scaled down until it's width is equal to or less than a certain number AND its height is equal to or less than another number, with NO cropping.

Any way to do this? Are there other variables that I can use above? (I couldn't find documentation of this anywhere, but it probably exists - I just don't know where to look.) Or is there a &x= where x will force it to NOT crop?

Thanks in advance!

Comments

  • The parameters are documented at the front of the i.php script.
  • Okay, thanks. Well... that's what I was afraid of. I think there's no simple way to get the result I want since cropping will occur. I thought it might work to use s and h, but it doesn't.

    So the next possible solution involves checking the image height and width BEFORE making the size calculation. I do this on the image page, but it seems those functions are not available from within the slideshow environment.

    Is there any way to get the dimensions of the original image from within the slideshow environment?
  • The functions would all be available, so I guess I am not sure what you are asking.
  • Hmm... in another thread, acrylian said:

    "The normal functions do not work since we are outside of any album/image context on the slideshow. Generally it is possible, but that is not really easy because of all the javascript stuff for preloading involved. Having generally the option to set a widht and height for Zenphoto images is on my list, but I am lacking time currently to get to it."

    For example, unless I'm missing something, functions like getFullHeight and getFullWidth don't work in the slideshow environment because we are outside the album/image context. So I'm trying to figure out how to obtain each images height and width before I size it.
  • acrylian Administrator, Developer
    Right, to get that into the slideshow you need to use image/album class methods (functions) directly. This is not really easy.

    Regarding the implementation of width / height in general, we decided to make separate functions for themes to not break themes. Also this would have needed too much changes in the core. So there are no admin options. These are now available in the nightly (not in the documentation yet):
    `getCustomAlbumThumbMaxSpace(), printCustomAlbumThumbMaxSpace(), getCustomSizedImageMaxSpace(), printtCustomSizedImageMaxSpace()`. These of course won't work in the slideshow, too, because of the missing context.
  • Right. Okay, so there's no way to grab the width and height of the original image from within the slideshow environment. :( Bummer, but at least it's a definitive answer. Thanks.
  • acrylian Administrator, Developer
    Not quite true, there is a way but that is more complicated than just using one function like getFullWidth() since you would have to use class objects. I indeed consider adding that sometime later but of course I can't promise when that will be.
  • okay - thanks. i'll wait patiently then. :)
Sign In or Register to comment.