Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 89143

微信打开相册后显示图片

$
0
0

@81141020 写道:

creator 微信打开相册并显示,图片选择后路径打印
"http://tmp/wx021d5723a31b0141.o6zAJsxHnEb2hLCVNxWj53eziz7k.X6lVNRP4oReK64a424463e9ce44a450bfe64894626a9.jpg"
我尝试着显示出来
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success (res) {
const tempFilePaths = res.tempFilePaths
console.log("path:"+tempFilePaths);//图片路径打印
cc.loader.load(tempFilePaths, function (err, tex) {
if (tex && tex.height != 0) {
let spriteFrame = new cc.SpriteFrame(tex);
let Background = cc.find("Canvas/OpenPhoto_Image/Background");
Background.spriteFrame=new cc.SpriteFrame(tex);
} else {
console.log("error:Invalid image!");
}
});
}
})
},
没有显示出来,也没有打印错误。

帖子: 1

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 89143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>