【发布时间】:2020-08-16 01:58:32
【问题描述】:
我正在研究一种解决方案,以解决由某些手机制作的图像由于在 exif 数据中具有方向而出现横向或上下颠倒的问题。到目前为止,我已经获得了方向,但是这个变量没有及时传递回去以进行下一个旋转步骤。
function getOrientation(image){
let ort = 1;
EXIF.getData(image, function () {
ort = EXIF.getTag(this, 'Orientation');
});
return ort;
}
来自 ort 的值稍后与画布结合使用以旋转上传的图像。如下图,但是每次改变都会使值变成1或者undefined。
let orientation = getOrientation(files);
let data = rotateImage(files, orientation);
将名为 ort 的变量传递回调用 getOrientation() 的函数的最佳方法是什么?
【问题讨论】:
标签: javascript exif-js