就算不公开, 你wifi上出去哪些请求都是能截取到的 实际也是防君子不防小人,没什么意义
建议官方不要公开小程序的后台地址现在小程序资料页面可以查看到小程序后台接口地址,从安全性和保密性两个方面,建议官方不要显示后台地址。 [图片]
2018-09-13手动实现了一下反转 // /utils/util.js const concatArrayBuffer = (... arrays ) => { let totalLength = 0 ; for ( let arr of arrays ) { totalLength += arr . length ; } let result = new Uint8ClampedArray ( totalLength ); let offset = 0 ; 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 * 4 ; for ( let i = 0 ; i < height ; i ++) { let start = i * width * 4 ; 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: 0 , y: 0 , 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 ( e ) { } ......
微信最新版(IOS 6.5.15),有的相片颠倒同一台手机,用[小程序示例]上传A图片正常,我们自己小程序、其他开发者的一个小程序上传A相片时颠倒 第一张是[小程序示例],第二张是我们自己小程序,第三张是一款其他开发者的已上线的共享相册小程序 ps.1.不是所有手机都会颠倒(目前测试感觉是IOS会颠倒、安卓不会) 2.不是所有的相片都会颠倒 [图片] [图片] [图片]
2018-08-21手动实现了一下反转 // /utils/util.js const concatArrayBuffer = (... arrays ) => { let totalLength = 0 ; for ( let arr of arrays ) { totalLength += arr . length ; } let result = new Uint8ClampedArray ( totalLength ); let offset = 0 ; 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 * 4 ; for ( let i = 0 ; i < height ; i ++) { let start = i * width * 4 ; 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: 0 , y: 0 , 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 ( e ) { } ......
canvasGetImageData返回的data数据与H5源生返回数据不同同样两张图片,对应同样的canvas大小(即图片本身大小),用H5 canvas获取到的数据与小程序内wx.canvasGetImageData获取到的数据有很大差距!(数组长度是相同的,但数据不同) H5获取数据如下: [图片] 小程序获取数据如下: [图片] 目测是api处理数据有误差?望排查~
2018-08-21手动实现了一下反转 // /utils/util.js const concatArrayBuffer = (...arrays) => { let totalLength = 0; for (let arr of arrays) { totalLength += arr.length; } let result = new Uint8ClampedArray(totalLength); let offset = 0; 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 * 4; for (let i = 0; i < height; i++) { let start = i * width * 4; 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: 0, y: 0, 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 (e) { } ......
putimagedata和getimagedata在ios中坐标系原点错误你想反馈一个 Bug 如果是 Bug: 使用wx.canvasPutImageData 画一组Uint8ClampedArray数据时,在微信开发者工具和安卓手机端看到的图如下: [图片] 而在IOS手机看到的图如下: [图片] canvas的坐标系原点是在左上角,但是微信的putimagedata和getimagedata在IOS上的坐标系原点在左下角。 * 提供一个最简复现 Demo var rectdata = [ 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, .............. //因为提问字数限制,删除了剩余数据 ]; Page({ data: { motto: 'Hello World', userInfo: {} }, putDraw: function() { const rectData = new Uint8ClampedArray(rectdata); wx.canvasPutImageData({ canvasId: 'secCanvas', x: 20, y: 20, width: 60, data: rectData, success(res) { console.log(res) }, fail(res) { console.log(res) } }) }, onLoad: function() {}, onReady: function() { this.putDraw() } }) 希望官方能尽快修复该bug~~
2018-08-21同样的问题+1
canvasGetImageData 数据顺序不正确ios 真机中获取数据从底部开始。与预期不符。 相似问题: https://developers.weixin.qq.com/blogdetail?action=get_post_info&docid=0002cc76fc066022334627f6358400&highline=canvasGetImageData
2018-08-21