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

You are not logged in.

  • Index
  •  »  / API
  •  » Returned Content Width & Height - How to find?

#1 2012-03-18 22:05:03

nickpotter
Member
From: UK
Registered: 2008-01-01
Posts: 31
Website

Returned Content Width & Height - How to find?

I have a variety of shaped images - portrait, landscape, square. When I call director I set up a custom format that has a width of 950 and a height of 550 but no cropping.

So if a landscape image is returned it will only have a width of 950 if this also means the height is 550 or below. For everything else, landscape, portrait or square it will show an image of height 550 and an unknown width.

Is there an easy way to find out the width of the content item returned?

I know I can use content->original->width/height and there's probably some messy maths I can use to work out what the returned images dimensions will be but is there a simpler way?

Thanks

Offline

 

#2 2012-07-17 02:45:56

ktheory
Member
Registered: 2007-03-07
Posts: 35

Re: Returned Content Width & Height - How to find?

+1 on this. Are the titles and image dimensions available in the array?

Offline

 

#3 2012-07-21 21:56:28

brandonguy
Veteran Member
Registered: 2008-02-07
Posts: 210

Re: Returned Content Width & Height - How to find?

in your loop:

Code:

  $data_array['video'][$count]['preview']=str_replace('\\','/',$image->original->url);
    $data_array['video'][$count]['height']=$image->original->height;
    $data_array['video'][$count]['width']=$image->original->width;
    $data_array['video'][$count]['ratio']=( $data_array['video'][$count]['width']/    $data_array['video'][$count]['height'])

then you can use the "ratio" key to mess with your other formats (since you know the ratio of the original before it was shrunk with the formats)

Offline

 
  • Index
  •  »  / API
  •  » Returned Content Width & Height - How to find?

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson