Get image orientation and correct dims from Camera

Have situation, when need to downsample copy of taken picure from camera.

For Image Resizer have provide width and height, so have get it from newly saved photo.

Saw lots suggestions with new Image() and read properties width and height, but problem is, it not decide image orientation and all time provide bigger dimension for X abd smaller for Y.

If use correctOrientation: true, it just does vicewersa, X getting smaller dimension, Y - bigger.

I played with device and screen orientations, to get real device position at camera shot moment, it useless, because between camera ON and OFF, orientation not accessible, and user can rotate device as wish.

Also tried exif-js to read exif info, it also provide wrong info.

Does anybody know way how to decide correct axis dimensions/orientation of saved from camera image?

Save here solution remarks:
to get correct dims used:

import * as nano from 'nanojpeg';

Constructor: private file: File,

this.file.readAsDataURL(path, file).then((data) => {
     let arr: any = this.convertDataURIToBinary(data);
     let decoded = nano.decodeJPEG(arr);

//use decoded.width;
//and decoded.height;

File.readAsArrayBuffer(path, file) not works, so had to proced through readAsDataURL with conversion to required by nanojpeg lib, Uint8Array

    convertDataURIToBinary(dataURI:string):any {
        let BASE64_MARKER = ';base64,';
        let base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
        let base64 = dataURI.substring(base64Index);
        let raw = window.atob(base64);
        let rawLength = raw.length;
        let array = new Uint8Array(new ArrayBuffer(rawLength));

        for(let i:number = 0; i < rawLength; i++) {
            array[i] = raw.charCodeAt(i);
        return array;

At IOS works fine