解决lrz对图片旋转的问题。

版本:4.9.41
问题:处理某些ios拍摄的图片会旋转90度
解决方案:在node_modules目录下找到lrz-->dist文件夹下的lrz.all.bundle.js,然后修改里面的代码。修改的地方有两个。
2516行:

var IOS_VERSION = ISOldIOS ? +ISOldIOS.pop().replace(/_/g, '.') : 0
改为:
var IOS_VERSION = ISOldIOS ? +ISOldIOS.pop().split('_')[0] : 0

2535行:

that.defaults = {
  width: null,
  height: null,
  fieldName: 'file',
  ingnoreOrientation: UA.iOS ? UA.newIOS : true,
  quality  : 0.7
};
改为:
that.defaults = {
  width: null,
  height: null,
  fieldName: 'file',
  ingnoreOrientation: null,
  quality  : 0.7
}
if(UA.android){
  that.defaults.ingnoreOrientation = false
}else{
  that.defaults.ingnoreOrientation = UA.iOS ? UA.newIOS : true
}

改完后请在真机浏览,不要用浏览器的模拟移动端访问

posted @ 2022-01-24 15:01  黑星星  阅读(405)  评论(0编辑  收藏  举报