- 需求的场景描述(希望解决的问题)
- 希望提供的能力
原照片尺寸太大,我规定了一个展示的大小,写在了<image>标签里,现在我只能取得原始照片的url,怎么能保存这个缩小后的照片呢?
页面代码:
<image src='{{src}}' style="width: {{width}}px;height: {{height}}px;" bindtouchmove="touch"></image>
js代码:
wx.getImageInfo({
src: tempFilePaths[0],
success: function (res) {
var canvasWidth = res.width
var canvasHeight = res.height;
var str = canvasWidth / canvasHeight;
canvasHeight = 500;
canvasWidth = str * canvasHeight;
_this.setData({
canvasHeight: canvasHeight,
canvasWidth: canvasWidth,
src
:tempFilePaths[0]
})
}
})