uploadImgs: function () {
var that = this
wx.chooseImage({
count: 1
sourceType: ['album', 'camera'],
sizeType: ['compressed'],
success: function (res) {
let tu1 = res.tempFilePaths[0];
wx.getImageInfo({
src: res.tempFilePaths[0],
success(res) {
let imgurl=res.path
let imgwidth=res.width;
let imgheight = res.height;
let destHeight=180
let destWidth = imgwidth * 180 / imgheight
var canvas = wx.createCanvasContext('card');
canvas.drawImage(imgurl, 0, 0, destWidth, destHeight);
canvas.draw(false,setTimeout(function () {
wx.canvasToTempFilePath({
canvasId: 'card'
succes: function (res) {
console.log('canvas-res', res)