wechat-miniprogram / wxml-to-canvas

MIT License
158 stars 42 forks source link

iphone8 生成带图片的海报失败, 微信版本号: 8.0.7, 调试库:2.16.1 #17

Open kiprunning opened 3 years ago

kiprunning commented 3 years ago

tmp/YEBHErVHQ86De13348d5ef2982c193d1becaefde55e5.jpg#devtools_no_referrer:1 GET http://tmp/YEBHErVHQ86De13348d5ef2982c193d1becaefde55e5.jpg net::ERR_PROXY_CONNECTION_FAILED(env: macOS,mp,1.05.2105170; lib: 2.16.1) Image (async) set src @ VM380:1 _drawImage @ index.js? [sm]:623 success @ index.js? [sm]:641 forEach.u. @ VM389 WAService.js:2 d @ VM389 WAService.js:2 (anonymous) @ VM389 WAService.js:2 p @ VM389 WAService.js:2 (anonymous) @ VM389 WAService.js:2 d @ VM389 WAService.js:2 (anonymous) @ VM389 WAService.js:2 (anonymous) @ VM389 WAService.js:2 value @ VM389 WAService.js:2 B @ VM389 WAService.js:2 (anonymous) @ VM389 WAService.js:2 (anonymous) @ VM389 WAService.js:2 c @ VM8 asdebug.js:1 u @ VM8 asdebug.js:1 (anonymous) @ VM8 asdebug.js:1 f @ VM8 asdebug.js:1 g @ VM8 asdebug.js:1 (anonymous) @ VM8 asdebug.js:1 _ws.onmessage @ VM8 asdebug.js:1 share.js? [sm]:144 ****error: Error: createImage fail: http://tmp/YEBHErVHQ86De13348d5ef2982c193d1becaefde55e5.jpg at HTMLImageElement.Image.onerror (index.js? [sm]:622)

shiyuanzheng commented 3 years ago

降到1.0.1版就可以,最新的1.1.1会有问题

jassybao commented 2 years ago

该组件在小程序库版本>=2.9.2时,会自动使用2d同层渲染的canvas,同时图片会使用canvas.createImage()来加载,但是这种加载方式不支持wx.downloadFile后的临时地址,所以会加载失败; 详情见下图源码: image

源码修改: image

(不保证后续更新,只做参考) 修正后的npm包: npm install --save jassybao-wxml-to-canvas

修正后的github地址: https://github.com/jassybao/wxml-to-canvas