javascript-LocalResizeIMG.js rotates 90 degrees when uploading images on iPhone, how to solve it
LocalResizeIMG.js rotates 90 degrees when uploading images on iPhone, how to solve it Reply content: LocalResizeIMG.js rotates 90 degrees when uploading images on iPhone, how to solve it This requires image rotation processing in this js source code var angle = ”; this.on(‘change’, function () { var file = this.files[0]; var URL = window.URL || webkitURL; var blob = URL.createObjectURL(file); var BinaryAjax = window.BinaryAjax || ”, EXIF = window.EXIF || ”; if (BinaryAjax && EXIF) { // get photo orientation and set angle BinaryAjax(blob, function(o) { var oExif = EXIF.readFromBinaryFile(o.binaryResponse), orientation = oExif.Orientation; switch(orientation) { case 6: angle = radians(’90deg’); break; case 3: angle = radians(‘180deg’); break; case 8: angle = radians(‘270deg’); break; } }); } // function before execution if($.isFunction(obj.before)) { obj.before(this, blob, file) }; _create(blob, file); this.value = ”; // Clear temporary data }); function radians(angle) { if (typeof angle == ‘number’) return angle; return { rad: function(z) { return z; }, deg: function(z) { return Math.PI / 180 * z; } }[String(angle).match(/[a-z]+$/)[0] || ‘rad’](parseFloat(angle)); }
javascript-LocalResizeIMG.js rotates 90 degrees when uploading images on iPhone, how to solve it
LocalResizeIMG.js rotates 90 degrees when uploading images on iPhone, how to solve it Reply content: LocalResizeIMG.js rotates 90 degrees when uploading images on iPhone, how to solve it This requires image rotation processing in this js source code var angle = ”; this.on(‘change’, function () { var file = this.files[0]; var URL = window.URL || webkitURL; var blob = URL.createObjectURL(file); var BinaryAjax = window.BinaryAjax || ”, EXIF = window.EXIF || ”; if (BinaryAjax && EXIF) { // get photo orientation and set angle BinaryAjax(blob, function(o) { var oExif = EXIF.readFromBinaryFile(o.binaryResponse), orientation = oExif.Orientation; switch(orientation) { case 6: angle = radians(’90deg’); break; case 3: angle = radians(‘180deg’); break; case 8: angle = radians(‘270deg’); break; } }); } // function before execution if($.isFunction(obj.before)) { obj.before(this, blob, file) }; _create(blob, file); this.value = ”; // Clear temporary data }); function radians(angle) { if (typeof angle == ‘number’) return angle; return { rad: function(z) { return z; }, deg: function(z) { return Math.PI / 180 * z; } }[String(angle).match(/[a-z]+$/)[0] || ‘rad’](parseFloat(angle)); }