Orientation of featured image in post?

Basic check of aspect ratio. Display as landscape, square or portrait

if ( !has_post_thumbnail()) { 
    return 'Error'; 
} else {
    $image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '');
    $image_w = $image[1];
    $image_h = $image[2];

    if ($image_w > $image_h) { 
        echo 'landscape';
    }
    elseif ($image_w == $image_h) { 
        echo 'square';
    }
    else { 
        echo 'portrait';
    } 
}