I am using the gallery field to display a gallery. No trouble with getting all the images into html.
For the layout, it would be neccessary to assign different classes to the images: portrait and landscape. And to render differnt sizes. Say, I have one thumb-size for portrait and one for landscape.
For the wp only solution, I ve been using this little snippet:
<?php
  $post_thumbnail_id = get_post_thumbnail_id( $post_id );
  $imgmeta = wp_get_attachment_metadata( $post_thumbnail_id );
  
  if ($imgmeta['width'] > $imgmeta['height']) {
    the_post_thumbnail('large', array('class' => 'landscape'));
  } else {
    the_post_thumbnail('medium', array('class' => 'portrait'));
}
?>
See what I am aming for?
I am sure, it can be done with the gallery filed as well. Unfortunately I am not sure where to start.. 
Thanks for help and thoughts
Cheers
mjut