These forums are provided for community interactions only. For official support please submit a support ticket.
You are not logged in.
Is there currently a way to ascertain the dimensions of a given director-generated image dynamically? Here's what i'm trying to do....
I would like to capture the exact height/width dimensions of an image as it gets loaded from Director... so that... I can then use those dimensions as variables that get inserted into some inline CSS styles on other (corresponding) elements that relate to the image. Wow, I hope that isn't too confusing.
<div class="caption" style="top:-642px;"> <div class="captionInner"> <span class="imageTitle"><?php echo $image->title ?></span> <span class="imageCaption"><?php echo $image->caption ?></span> </div> </div>
...so in this case... I need to somehow get the image HEIGHT dimension so that I can use some simple math to arrive at the "-642px" number. (I'm using some relative positioning to overlay captions on top of my images. If each image was the exact same height, it would be easy. But I don't want to be limited to having every image be the same height.)
Again, sorry if this is convoluted or very noobish. Any help at all would be much appreciated. Thanks.
Thanks for the tips! I'll check that out and see what I can come up with...
Perhaps if thedirector API had a method for resolving the director source url to a realPath for the image, the cached image. Not sure how possible that would be but it would make all sorts possible
open up a whole new range of possiblites
I agree. Seems like that would make things a lot simpler, and bit easier to work with.
well, here's what I did for now (that works)...in case anyone's interested...
<?php list($width, $height) = getimagesize($image->large); ?>
then just used a simple equation to accomplish my relative positioning shift...
$captionVertShift = $height+18;
and then inserted the variables $captionVertShift and $height in the XHTML accordingly.
<div class="caption" style="top:-<?php echo $captionVertShift;?>px;">
I'll see if we can return the width and height of the optimized image. The above can be a little (or a lot) slow if the image hasn't been created yet.
Yes, indeed it is slow. :-) In fact, I just isolated the slowness that I referred to in my other post, to this issue.
If there was a way to return the dimensions that would be awesome.
As always, thanks Brad.
Last edited by bd1121 (2008-04-19 07:51:26)
I hate to pester (as I know how hard you guys are working on this baby) -- I just wondered if by chance we may be getting a bit closer to having another round of goodness come our way with the API -- I'm *this* close to having my new site cranking on all cylinders, but I'm waiting for this fix (hoping that there is one) before I turn on some of the features on it. I can do it (slowly) like I showed above, but everything else so far is so fast with the API, I hate to bog down the performance on the site with a hack-y fix like the one above.
Again, not at ALL unhappy with the progress or features so far... just putting feelers out there for when we might get some more. (?)
We're working on it, remember...it's a beta
Beta 5 is getting very close to being released, and will feature a revamp of the API with more features and better docs. Stay tuned...
Woo hoo! Yes, beta it is. But it's a lovely one. :-)
Thanks for the update.
I've been picking through the new API info (which is great by the way)... and I don't yet see a way to return the width and height of the optimized images -- although, I'm very aware that I may be missing something...
Is this (yet) possible? If so, could you point me in the right direction?
Ben - Check the examples on this page, it shows how to access the w/h of optimized imagery: