EXIF.js gets picture information

problem description

using exif.js to get the direction information of a picture has been reported incorrectly. Some pictures have the following errors, and some pictures can get the direction information of a picture more than enough

related codes

/ / Please paste the code text below (do not replace the code with pictures)

   

Jun.24,2022

is a problem with the EXIF.js library itself. This problem occurs when parsing images with a resolution greater than 600dpi, which has not been solved so far. see here . If you just want to get the direction of the picture, you can use the following code:

getOrientation = function (file, callback) {
    var reader = new window.FileReader();
    reader.onload = function (e) {

        var view = new window.DataView(e.target.result);
        if (view.getUint16(0, false) != 0xFFD8) {
            return callback(-2);
        }
        var length = view.byteLength, offset = 2;
        while (offset < length) {
            var marker = view.getUint16(offset, false);
            offset += 2;
            if (marker == 0xFFE1) {
                if (view.getUint32(offset += 2, false) != 0x45786966) {
                    return callback(-1);
                }
                var little = view.getUint16(offset += 6, false) == 0x4949;
                offset += view.getUint32(offset + 4, little);
                var tags = view.getUint16(offset, little);
                offset += 2;
                for (var i = 0; i < tags; iPP) {
                    if (view.getUint16(offset + (i * 12), little) == 0x0112) {
                        return callback(view.getUint16(offset + (i * 12) + 8, little));
                    }

                }
            } else if ((marker & 0xFF00) != 0xFF00) {
                break;
            } else {
                offset += view.getUint16(offset, false);
            }
        }
        return callback(-1);
    };
    reader.readAsArrayBuffer(file);
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b391ac-2b4cd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b391ac-2b4cd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?