我正在使用Ionic 2创建一个应用程序,其中一个功能是更新您的头像。典型的东西。当用户更新头像时,必须下载新的头像。
如何做到这一点?是否有事件(上传完成后重新获取镜像),还是仅在上传后重新获取镜像?
发布于 2017-02-13 19:12:24
你只需要使用你调用的方法的返回承诺来保存你的新头像。
firebase.storage().ref('/ProfilePictures/').putString(MyPicBase64String, 'base64', { contentType: 'image/png' }).then((pic) => {
let newPic = pic.downloadURL; // save in a new var, a global var, your sql/localStorage, the var in your <img />, etc
});如果需要单独完成,可以调用.getDownloadURL()方法
firebase.storage().ref('/ProfilePictures/MyUserNewPicture.png').getDownloadURL().then((pic) =>{
// do your stuff
})https://stackoverflow.com/questions/42198515
复制相似问题