图片上传的旋转角度问题
Opened this issue · 0 comments
PLDaily commented
exif获取旋转角度
使用exif获取图片orientation信息
EXIF.getData(that.file, function (event) {
var allTags = EXIF.getAllTags(this);
var orientation = allTags.Orientation;
})
orientation的含义
如上俩图所示,我们需要对orientation为3,6,8图片进行矫正switch (orientation) {
case 6:
//需要顺时针(向左)90度旋转
alert(90)
break;
case 8:
//需要逆时针(向右)90度旋转
alert(270)
break;
case 3:
//需要180度旋转
alert(180)
break;
}
示例
https://github.com/PLDaily/exif