Help needed to find image dimensions

Help needed to find image dimensions

I'm using Preview.js to create image previews on hover. The script as
it is now displays the full size image on hover, but that is often too
big. I have been able to reduce the preview size by defining
width='200px' which works fine in many cases, but when the image is
tall and narrow a 200px wide image my be 700px tall. So what I'm
trying to do is determine the image dimensions and if the width is
greater than the height, set width='200px', otherwise set
height='200px'. I haven't been able to figure out how to get the
image dimensions from the wrapped set.
Here is an excerpt of my markup: