here is the jquery
$('#pl').find('img').each(function(i, elem) {
var $this = $(this),
ratio = $this.width() / $this.height();
$this.addClass((ratio < 1) ? 'portrait' : 'landscape');
});
html:
<div id="pl">
<img src="#" width="60" height="30" />
<img src="#" width="30" height="60" />
<img src="#" width="40" height="80" />
<img src="#" width="90" height="50" />
<img src="#" width="60" height="30" />
<img src="#" width="40" height="80" />
</div>
and here's the example in jsfiddle.net >>> SAMPLE
Include Jquery in Head
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(window).load(function () {
$('#pl').find('img').each(function (i, elem) {
var $this = $(this),
ratio = $this.width() / $this.height();
$this.addClass((ratio < 1) ? 'portrait' : 'landscape');
});
});</script>