(1).加载时
<view> <image src="{{tempFilePaths}}" mode="aspecFill" /> <text>图片的大小:{{imgwidth}}px*{{imgheight}}px</text></view>
var app = getApp() Page({data: { tempFilePaths: ../uploads/foods.jpg,imgwidth:0,imgheight:0, },onReady:function(){// 页面渲染完成 var _this = this; wx.getImageInfo({src: _this.data.tempFilePaths,success: function (res) {_this.setData({imgwidth:res.width,imgheight:res.height,})}}) } })