我也遇到了,你解决了?
扫一扫接口设置scanType仅为qrCode,安卓手机为什么还是能够扫出条形码?[图片]
2020-01-07原因是:pixelRatio的问题,需要转换下像素,例如图片想要缩放为:500,则实际转换到设备上的像素为=500 / pixelRatio
华为META9机器canvas.drawImage后canvasToTemp图片大小不对?机型:HUAWEI META9 机型:HUAWEI META9 MHA-AL00 微信版本号:7.0.7 系统版本号:8.0.0 能复现问题的代码片段: [代码]wx.getImageInfo({[代码][代码] [代码][代码]src: imagePath,[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码] [代码] [代码][代码]// 生成指定宽度的图片[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]canvasWidth: canvasWidth,[代码][代码] [代码][代码]canvasHeight: canvasHeight [代码][代码] [代码][代码]})[代码][代码] [代码][代码]var[代码] [代码]ctx = wx.createCanvasContext([代码][代码]'tmpImage'[代码][代码]);[代码][代码] [代码][代码]ctx.drawImage(imagePath, 0, 0, canvasWidth, canvasHeight );[代码][代码] [代码][代码]ctx.draw([代码][代码]false[代码][代码], [代码][代码]function[代码][代码]() {[代码][代码] [代码][代码]//保存临时文件[代码][代码] [代码][代码]wx.canvasToTempFilePath({[代码][代码] [代码][代码]canvasId: [代码][代码]'tmpImage'[代码][代码],[代码][代码] [代码][代码]fileType: [代码][代码]'jpg'[代码][代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log(res.tempFilePath)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码](error) {[代码][代码] [代码][代码]console.log(error)[代码][代码] [代码][代码]reject(error)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}) [代码][代码] [代码][代码]})[代码]
2019-11-28