I've seen a few posts on this, but no resolution. I would like to use printCustomSizedImageMaxSpace for thumbs, which is fine for pix, but seems to break for videos. It uses the actual video file instead of the same-name thumb, which totally makes sense because the function has no way of knowing whether you're trying to print a custom size of the actual image for display or for thumb purposes.
So what we REALLY need is a separate function:
printCustomSizedImageTHUMBMaxSpace
Am I missing something? Is there a way to print custom sized thumbs that work correctly for video?
Thanks in advance!
Comments
i checked out the function descriptions for the nightly. unless i'm missing something, the CustomSizedImageMaxSpace functions do not have a parameter that determines whether the image to be printed is the actual image or the thumb. is there some way to tell the function this? class? id?
i.e., i'm afraid i need a little more guidance in calling the custom sized thumb functionality - thanks in advance!
`printCustomSizedImageMaxSpace(,,,"","", true)` should at least work for the thumbnails (for the album thumbs, the album preview one, there is a separate function.
Actually we are still not finished since new issues just occured but those only affect usage on image.php currently. This little function do somehow cause more overhead than expected...
And the printCustomSizedImageThumbMaxSpace isn't working at all for me, but I think it might be something with my mbstring changing when I upgraded to the nightly build. Can't figure out how to change it back to UTF-8 since my config and ini files both already say UTF-8. Not sure that's the problem anyway. Any thoughts?
function printCustomSizedImageThumbMaxSpace($alt='',$width,$height,$class=NULL,$id=NULL) {
printCustomSizedImageThumbMaxSpace($alt,$width,$height,$class,$id, true);
}
Shouldn't that second occurence be "printCustomSizedImageMaxSpace" instead of "printCustomSizedImageThumbMaxSpace"? The function is currently calling itself.
--
Regarding the document, I'm hoping to get to it soon. I've been taking notes along the way, so that should help. I'm thinking that it should basically be a general help doc for people who live somewhere between completely non-technical and all you programmer types. It should also be useful to the completely non-technical folks, too.
I've decided that my first priority will be to get my own site finally functional, and then turn to the document. I haven't really joined any of the programmer discussions yet, but will hopefully turn to that when I start working on the doc.
I am looking forward to the document to see how you can make necessary technical stuff understandable to non-technical folks..:-)
so... can you tell me if I'm interpreting MaxSpace correctly? My interpretation is that the function decreases the image size as far as it has to so that the height AND width are both lower than or equal to the inputs to the function. Further, the image is not cropped.
If this interpretation is correct, then I don't believe that the function is working properly. Is this a work-in-progress and should I just wait for a bit, or am I interpreting things incorrectly?
It is still the nightly and with software in general, it is working properly until someone finds it is not...:-) I guess you need to wait a little more.
here's a test gallery:
http://www.stanats.com/gal02/index.php?album=testalbum&image=07.jpg
look on the right for the number grid. the one on top uses my own functions, and the one on bottom, marked "MAXSPACE Version" uses the new functions. The images are supposed to max out at (120,100), but they don't.
The call I'm making is:
printCustomSizedImageThumbMaxSpace('',120, 100);
I've looked at the current code for the function and I haven't noodled all the way through it, but I think the sizing logic is faulty. I'm using this logic in my function:
if (getFullWidth()/getFullHeight() >= $width/$height)
/** then the image is relatively wider than the target size,
* so make it max width (height will be less than max) */
print(getCustomImageURL(null, $width));
else
/** then the image is relatively taller, so make it max height */
print(getCustomImageURL(null, null, $height));
This doesn't include the cases where $width or &height is not passed, but those simply fall into these same two categories. Obviously, the getCustomImageURL function can't be used by you guys in this situation since it doesn't deal with thumbs, but that's exactly why I'm waiting for this function.
Hope this helps!
`
$percentuser = 550 / 100;
$heightpercent = round(380 / $percentuser);
$fullpercent = getFullWidth() / 100;
$fullheightpercent = round(getFullHeight() / $fullpercent);
if (getFullWidth() === getFullHeight() OR $fullheightpercent > $heightpercent) {
printCustomSizedImage(getImageTitle(), null, null, 380, null, null, null, null, getImageID());
} else {
printCustomSizedImage(getImageTitle(), null, 550, null, null, null, null, null, getImageID());
}
`
That is working but has not been tested with thumbs at all... These little functions really bug more than expected...:-)
simply, i think it makes most sense to use something like (syntax is wrong, but algorithm is the important part):
case
($width = 0 AND $height = 0) then error handling? or just full size?
($width = 0 OR (FullWidth/FullHeight >= $width/$height) then adjust to $height
else adjust to $width
i think that should do it.
any chance somebody could insert the algorithm i've provided above into the functions? I think it would be a quick fix since it seems like the problem is that they simply aren't calculating the size correctly.
looks like it might all be calculated in getMaxSpaceContainer, but that function seems to be written in a much more convoluted manner than necessary (imho). unfortunately, that function seems to be using some php concepts that I don't yet understand (e.g., &$width).
-passing NULL for width produces unexpected results (what SHOULD happen is the the image just gets constrained via the height variable)
-strangely, the following two calls do NOT produce the same results:
1. printCustomSizedImageMaxSpace('', $width, $height, null, null, true);
2. printCustomSizedImageThumbMaxSpace('', $width, $height);
the first one stretches the image incorrectly; the second one seems to work (I haven't looked at the new code, but in a previous version one of these functions just called the other, so it seems strange that these two calls produce different results)
Hope this helps...
Hm regarding the stretching. I did really a lot test a few days ago and I didn't notice any stretching anymore. Did you purge the cache? Just to ask...
The only difference between the `printCustomSizedImageMaxSpace(0)` and `printCustomSizedImageThumbMaxSpace()` functions is how they handle the case of video images. `printCustomSizedImageThumbMaxSpace` will use the video thumbnail image. `printCustomSizedImageMaxSpace()` will use the configured flash plalyer so the function is effectively NULL.