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:
getCustomImage(null, $width, $height, null, null, null, null)
with this:
getCustomSizedImageMaxSpace($width, $height)
Nope. Doesn't work. No code is output, the php dies unexpectedly.
Can someone suggest what I'm doing wrong? Is there a known bug with getCustomSizedImageMaxSpace()?
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:
global $_zp_image_current;getCustomSizedImageMaxSpace($width, $height)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:
`