These forums are provided for community interactions only. For official support please submit a support ticket.

You are not logged in.

  • Index
  •  »  / API
  •  » Getting specific image info...dimensions?...

#1 2008-04-14 22:21:46

bd1121
Veteran Member
From: Spokane, WA
Registered: 2006-03-15
Posts: 106
Website

Getting specific image info...dimensions?...

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.

e.g.:

Code:

<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.

Ben

Offline

 

#2 2008-04-15 17:06:28

bwsewell
Member
Registered: 2006-09-06
Posts: 29
Website

Re: Getting specific image info...dimensions?...

There are some methods built into PHP that can help you do this... not sure how you would use it in this case... but just for future reference:

http://us2.php.net/manual/en/function.imagesx.php

http://us2.php.net/manual/en/function.imagesy.php

Offline

 

#3 2008-04-15 17:16:00

bd1121
Veteran Member
From: Spokane, WA
Registered: 2006-03-15
Posts: 106
Website

Re: Getting specific image info...dimensions?...

Thanks for the tips! I'll check that out and see what I can come up with...

Offline

 

#4 2008-04-15 17:27:37

fruits
Veteran Member
Registered: 2006-03-15
Posts: 543

Re: Getting specific image info...dimensions?...

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


A SlideShowPro & Director (API) enthusiast
-=-=-=-=-=-=-=-=-=-=-=-
I debug SSP with these exts which really ease the burden Get FireFox & Get FireBug I use swfObject to display flash *still dreaming for a few things namely CUSTOM transitions & smart galleries for dirctor

Offline

 

#5 2008-04-15 17:42:42

bd1121
Veteran Member
From: Spokane, WA
Registered: 2006-03-15
Posts: 106
Website

Re: Getting specific image info...dimensions?...

I agree. Seems like that would make things a lot simpler, and bit easier to work with.

Offline

 

#6 2008-04-15 18:53:02

bd1121
Veteran Member
From: Spokane, WA
Registered: 2006-03-15
Posts: 106
Website

Re: Getting specific image info...dimensions?...

well, here's what I did for now (that works)...in case anyone's interested...

Code:

<?php 
list($width, $height) = getimagesize($image->large);
?>

then just used a simple equation to accomplish my relative positioning shift...

Code:

$captionVertShift = $height+18;

and then inserted the variables $captionVertShift and $height in the XHTML accordingly.

Code:

<div class="caption" style="top:-<?php echo $captionVertShift;?>px;">

Offline

 

#7 2008-04-15 21:32:24

bdaily
Director director
From: Nixa, MO
Registered: 2006-03-15
Posts: 11841
Website

Re: Getting specific image info...dimensions?...

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.


Brad Daily
support.director[at]slideshowpro.net

Offline

 

#8 2008-04-15 22:04:29

bd1121
Veteran Member
From: Spokane, WA
Registered: 2006-03-15
Posts: 106
Website

Re: Getting specific image info...dimensions?...

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.

Ben

Last edited by bd1121 (2008-04-19 07:51:26)

Offline

 

#9 2008-05-01 23:43:05

bd1121
Veteran Member
From: Spokane, WA
Registered: 2006-03-15
Posts: 106
Website

Re: Getting specific image info...dimensions?...

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. (?)

:-)  Thanks,

Ben

Offline

 

#10 2008-05-02 03:17:45

bdaily
Director director
From: Nixa, MO
Registered: 2006-03-15
Posts: 11841
Website

Re: Getting specific image info...dimensions?...

We're working on it, remember...it's a beta smile

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...


Brad Daily
support.director[at]slideshowpro.net

Offline

 

#11 2008-05-02 03:24:46

bd1121
Veteran Member
From: Spokane, WA
Registered: 2006-03-15
Posts: 106
Website

Re: Getting specific image info...dimensions?...

Woo hoo! Yes, beta it is. But it's a lovely one. :-)

Thanks for the update.

Offline

 

#12 2008-05-26 06:29:48

bd1121
Veteran Member
From: Spokane, WA
Registered: 2006-03-15
Posts: 106
Website

Re: Getting specific image info...dimensions?...

Brad,

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?

thanks,

Ben

Offline

 

#13 2008-05-26 14:09:59

bdaily
Director director
From: Nixa, MO
Registered: 2006-03-15
Posts: 11841
Website

Re: Getting specific image info...dimensions?...

Ben - Check the examples on this page, it shows how to access the w/h of optimized imagery:

http://wiki.slideshowpro.net/SSPdir/API-DirPHP-OnDemand


Brad Daily
support.director[at]slideshowpro.net

Offline

 

#14 2008-05-26 19:30:10

bd1121
Veteran Member
From: Spokane, WA
Registered: 2006-03-15
Posts: 106
Website

Re: Getting specific image info...dimensions?...

Aaaah. I see it now. I had seen that page, but had misread/misunderstood it at first. Making sense now. Thanks Brad.

Offline

 
  • Index
  •  »  / API
  •  » Getting specific image info...dimensions?...

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson