微信6.7.2版本 wx.getImageInfo(OBJECT) 问题

发布于 7 年前作者 xuefang12335 次浏览最后编辑 7 年前来自 ask

 使用 wx.getImageInfo(OBJECT)接口,使用存储文件路径和相对路径在微信6.7.2版本被报错:errMsg:“getImageInfo:fail:file not not found”; 急救

5 回复
qiang96
qiang961 楼6 年前

    var that = this;
    wx.getSystemInfo({
      success:function(res){
        var width = res.windowWidth
        wx.getImageInfo({
          src: “…/…/images/index.png”,
          success: function (res) {
            var height = res.height*width/res.width
            console.log(res);
            that.setData({
              width: width,
              height: height
            });
          },
          complete: function(res){
            console.log(res);
          }
        })
      }
    });

xiuying50
xiuying502 楼6 年前

不同的机型和版本表现不同,有时可以,有时报错

taogong
taogong3 楼6 年前

你好 有解决方法吗

wzou
wzou4 楼6 年前

同遇到这个问题,很急,楼主解决了吗

lima
lima5 楼5 年前

麻烦给个相关的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),我们定位下问题