html52.com
我爱小程序-开发者交流社区

微信最新版(IOS 6.5.15),有的相片颠倒

问题模块
API和组件

同一台手机,用[小程序示例]上传A图片正常,我们自己小程序、其他开发者的一个小程序上传A相片时颠倒


第一张是[小程序示例],第二张是我们自己小程序,第三张是一款其他开发者的已上线的共享相册小程序


ps.1.不是所有手机都会颠倒(目前测试感觉是IOS会颠倒、安卓不会)   2.不是所有的相片都会颠倒


不是所有的相片都会颠倒



不是所有的相片都会颠倒




不是所有的相片都会颠倒

网友回复

夏日柚子茶:

手动实现了一下反转

// /utils/util.js

const concatArrayBuffer = (... arrays => {

let totalLength ;

for let arr of arrays ) {

totalLength += arr length ;

}

let result new Uint8ClampedArray totalLength );

let offset ;

for let arr of arrays ) {

result set arr offset );

offset += arr length ;

}

return result ;

}


const revertImage = ( data width height => {

if (! data return data ;

let dataViews = [];

let len width ;

for let height ++) {

let start width ;

let newBuff data slice start start len );

dataViews unshift newBuff );

}

let result concatArrayBuffer (... dataViews );

return result buffer ;

}


module exports = {

revertImage

}


// /pages/XXXPage.js

wx canvasGetImageData ({

canvasId: 'myCanvas' ,

x: ,

y: ,

width: width ,

height: height ,

success res ) {

wx hideLoading ();

// 3. IOS图像反转

let buffer res data buffer ;

try {

let systemInfo wx getSystemInfoSync ();

let platform systemInfo platform ;

if platform === 'ios' ) {

buffer util revertImage res data res width res height );

}

catch ) {

}

......


陶佳:

知道问题在哪了,示例用的wx.previewImage,我们因为要对图片进行处理不能用wx.previewImage,用的image  ,同时用了wx.getImageInfo ,但wx.getImageInfo没返相片exif中的Orientation 方向


会解决这个问题么?谢谢@黄思程

黄思程:

调用接口的代码能否发一下看看

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付