收藏
回答

生成画布图片失败!

问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 小程序 Bug canvasToTempFilePath 客户端 7.0.4 2.6.6

- 当前 Bug 的表现(可附上截图)


- 预期表现


- 复现路径


- 提供一个最简复现 Demo


wx.canvasToTempFilePath({
            x: 0,
            y: 0,
            width: 600,
            height: 950,
            destWidth: posterWidth * 4,
            destHeight: posterHeight * 4,
            canvasId: 'shareImgOne',
            success: function (res) {
              console.log(res.tempFilePath);
              that.setData({
                shareImgSrc: res.tempFilePath
              })
              //wx.saveImageToPhotosAlbum将图片保存到本地  3
              wx.saveImageToPhotosAlbum({
                filePath: that.data.shareImgSrc,
                success(res) {
                  wx.hideLoading();
                  wx.showModal({
                    title: '存图成功',
                    content: '图片成功保存到相册了,去发圈噻~',
                    showCancel: false,
                    confirmText: '好哒',
                    confirmColor: '#72B9C3',
                    success: function (res) {
                      if (res.confirm) {
                        that.setData({
                          bigModel: false
                        })
                        console.log('用户点击确定');
                      }
                    }
                  })
                }
              })
            },
            fail: function (res) {
              console.log(res);
              that.setData({
                bigModel: false
              })
            }
          });

总是提示canvasToTempFilePath:fail:create bitmap failed,搞不懂啥原因

posterWidth

posterHeight

这两个是屏幕的宽高

回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容