![]() |
|
getCustomSizedImageMaxSpace() doesn't work - 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: getCustomSizedImageMaxSpace() doesn't work (/thread-5410.html) |
getCustomSizedImageMaxSpace() doesn't work - glebec - 2009-07-01 Hello, Fatman's official script to display a photo externally is nice, but it resizes images to fit in the height/width instead of fitting them. So if I have portrait orientation pics, and I ask for a photo that is within 400 px wide x 300 px tall, it squashes the image and makes people look fat. It seems as if this should have a very simple fix, namely, replace this: Can someone suggest what I'm doing wrong? Is there a known bug with getCustomSizedImageMaxSpace()? getCustomSizedImageMaxSpace() doesn't work - glebec - 2009-07-01 FYI I solved this by teaching myself a little bit about global variables and php objects. YAY! I now propose an updated version of Fatman's script with the following modifications:
Why this works: Fatman's script created the object randomImage, and then used the getCustomImage function that resides inside all image objects (defined in the zenphoto "image" class). HOWEVER, getCustomSizedImageMaxSize() is NOT a function of the image class! Instead, it is a template function that depends on an image set in the global variable $_zp_current_image. This variable is usually set in theme loops by some code in each page template. But fatman's script never actually put any information in $zp_current_image, so the function had nothing to pull information from. Hence the early script death I kept seeing. Below is my current revision to Fatman's script: ` getCustomSizedImageMaxSpace() doesn't work - sbillard - 2009-07-01 There is a function to make an image the current image. getCustomSizedImageMaxSpace() doesn't work - glebec - 2009-07-01 SBillard, Thanks for that, I only installed ZenPhoto yesterday so I'm catching up as fast as I can! Love the app in general by the way. Here is an updated script, does this pass muster? getCustomSizedImageMaxSpace() doesn't work - sbillard - 2009-07-01 Look good to me. Of course, I have not tried it.... |