well... it is much closer to working now, but it is still buggy. so far, i've discovered the following problems:
-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...