Find out image dimension

Is there anyway to read image’s dimension?
I need to automatically rotate landscape photo to portrait in a lock orientation mode.
Sounds simple but can’t find the function to read width and height of the image.

Thank you for any suggestions!

The image metadata lets you read the size of it, among other things like mimeType so I don’t think it’s possible on the front end, except with some heavy duty workaround.
I’d recommend using your server’s functionalities for such image processing or an external API.

Thanks Fred, I guess external API could be way forward…