I'd like to use plain javascript to apply either the class name `portrait` or `landscape` to all `<img>` elements with a certain class name based on whether the image file itself is taller than it is wide (portrait orientation) or wider than it is tall (landscape orientation).

I know I can get all of the elements by class name like so:

`var portalPics = document.getElementsByClassName("portal-pic");`

And I think I can tell the orientation of each image file by comparing the `naturalHeight` and `naturalWidth` properties of [the HTMLImageElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement), but I'm not sure how.

Can anyone help me write the script that I would insert before the closing `</body>` tag in my HTML document that would automatically add the desired class names to the desired images?