canvasToTempFilePath生成图片失败;在多个回调里面。
1,wx.chooseImage({//获取照片
2,success: function (res) {//选择一张照片成功
3,wx.getImageInfo({//获取照片大小
4,success: function (res) {//获取成功
5,
that.setData({//设置canvas大小,(缩放后的)
tempCanvasWidth:thumbnailWidth,
tempCanvasHeight:thumbnailHeight,
tempCanvasDisplay:“block”
})
const ctx = wx.createCanvasContext(‘tempCanvas’)
ctx.drawImage(originalImagePath, 0, 0, thumbnailWidth, thumbnailHeight)
ctx.draw()//画图
6,wx.canvasToTempFilePath({//生成canvas里面的图片
7,fail:function(res){//失败
机器:iPhone 6 ios9.3.2