JSFiddle - React, Tailwind, and code Playground

HTML

<div><img src='http://tinyurl.com/y8axdm7' /></div>
<div><img src='http://tinyurl.com/2c34xfu' /></div>

CSS

.oversized { /* make the image align to center */
    text-align: center;
}
.oversized * { /* Anything in the oversized div will have a border (the image) */
    border: 1px solid black;
}

JavaScript

$(document).ready(function() {
    $('img').each(function(e) {
        if (($(this).height() > 300) || ($(this).width() > 300)) {
            $(this).parent().addClass('oversized');
        }
    });
});