using printCustomSizedImageMaxSpace for video thumbs

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

  • bump... help!
  • acrylian Administrator, Developer
    Please try the latest nightly.
  • ok, but can you give me a bigger hint?

    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!
  • acrylian Administrator, Developer
    The last parameter $thumbstanding has set to "true" if you want a thumb. The id is for a css id only.

    `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...
  • okay - perfect! i misunderstood this because it only talks about watermarking. thanks very much! and yes, i've seen that this function is causing problems. but it is such a useful function and can used for so much, i think it's worth it. thanks very much for developing it!
  • acrylian Administrator, Developer
    The currently nightly now also includes a variante called `printCustomSizedImageThumbMaxSpace()` for thumbs to avoid the missing of that option.
  • Hmm... I seem to be having some trouble with this. I've tried to use printCustomSizedImageMaxSpace, but the sizing parameters don't seem to work correctly. AND it seems like it's cropping the images. Are these known issues?

    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?
  • There were still some problems with the functions. Try again with tonight's build. The issues are not with your mbstring setting, though.
  • BTW, just curious. Any progress on the user document you were going to work on?
  • Yea, I posted this find elsewhere, but I'll repeat it here if it helps. Upon examining the thumb version of the function, I think it's not correct:

    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.
  • acrylian Administrator, Developer
    The typo you describe has already been fixed in tonight's nightly..:-)

    I am looking forward to the document to see how you can make necessary technical stuff understandable to non-technical folks..:-)
  • okay - glad to hear that is fixed.

    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?
  • acrylian Administrator, Developer
    You are interpreting the function correctly, that is how it is meant to work. But indeed it still does not work 100% correctly.

    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.
  • ok, thanks. for the record, it appears that the sizing portion of the function is not working properly. i'm getting all sorts of weird size results.
  • Have you tried last night's build? If that is still giving problems we will need the images that are failing along with the parameters you are using.
  • yep, using last night's build. still not working correctly.

    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!
  • acrylian Administrator, Developer
    Actually we know there is a bug somewhere. On a site I did I used this more (and perhaps overly) complicated code for the image on image.php but that was before we started to rework the maxspace functions. (500x380 is the size setting):
    `
    $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...:-)
  • um... yes, that does seem a bit heavier than necessary, but it also seems correct, unlike the current code. :)

    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. :)
  • wondering if this has been resolved and i should install a new nightly build...
  • acrylian Administrator, Developer
    Please try 1.2.2, there is nothing new regarding that in the nightly yet.
  • bummer... those functions in 1.2.2 are still broken. :(

    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).
  • You've tried the current nightly build?
  • Um... no... 'cause acrylian said there's nothing new in the nightly build. but I'll try it now and post back if it still doesn't work. thanks!
  • acrylian Administrator, Developer
    Four days ago there wasn't anything new regarding that, now it is...:-)
  • 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...
  • acrylian Administrator, Developer
    Regarding passing NULL for width: These functions are supposed to have always set width and height. That is what they are made for to fit into width x height without cropping. Leaving one out does not makes sense to me...

    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...
  • Passing NULL for a width or height value is the same as passing 0. These functions requrire both parameters. If you want them to be the same value, pass the value as both the height and the width.

    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.
Sign In or Register to comment.