Portrait/Landscape Image Detection

Getting the data

In order to be able to manage both portrait and landscape image formats, we need to be able to figure out the dimensions of an image

$image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), “thumbnail” );

$image_data is:
[0] => url
[1] => width
[2] => height
[3] => boolean: true if $url is a resized image, false if it is the original.

Determining the layout

Homepage Slideshow

Basically we need to compare width/height.  Since the designed ratio is 4:3, we compare to that ratio.
width/height is greater than 4/3 then use width=100%
width/height is less than 4/3 then use height=100%

Art Gallery

Not sure whether we just look at which one is bigger, or at a 4/3 ratio, like the homepage.
width/height is greater than 4/3 (or 1?) then use width=100%
width/height is less than 4/3 (or 1?) then use height=100%

Theme Integration

Homepage Slideshow

Programs

 

Comments are closed.