Add class to a views field depending on image's being vertical or horizontal
The answer could be approached from various angles. Simpler perhaps would be to target the template_preprocess_image itself, and add a div wrapper around it with the class, or just add the class on the img tag. I chose to do it via template_preprocess_field.

function THEME_preprocess_field(&amp;$vars) {
  if ($vars['element']['#field_name'] == 'field_IMAGE_NAME') {
    foreach($vars['items'] as $key =&gt; $item){
      if (_add_image_proportions_class($item)) {
        if ($item['#item']['width'] &gt; $item['#item']['height']) {
          $vars['classes_array'][] = 'landscape';
        }
        else if ($item['#item']['width'] &lt; $item['#item']['height']) {
          $vars['classes_array'][] = 'portrait';
        }
        else {
          $vars['classes_array'][] = 'square';
        }
      }
    }
  }
}

function _add_image_proportions_class($item) {
  return $item['#image_style'] == 'medium';
}


_add_image_proportions_class() is just a function you implement to test whether you want to add the class or not. In my example, I targeted the image style that is applied to the image. You could for instance create a specific image style that is used only for that view, and target it specifically. Or you could test the path you are on, etc.