0
我有這樣的代碼直接從火力地堡的文檔:如何從Firebase的存儲中檢索圖片的網址?
// Create a reference to the file we want to download
var user = firebase.auth().currentUser.uid;
var storageRef = firebase.storage();
var pathReference = storageRef.ref('/' + user + '/profilePicture/' + image.name);
//var starsRef = storageRef.child('/' + user + '/profilePicture/' + file.name);
// Get the download URL
pathReference.getDownloadURL().then(function(url) {
// Insert url into an <img> tag to "download"
$scope.imageUrl = url;
console.log($scope.imageUrl);
});
但我不圖什麼在我的html文件寫入,以獲得圖像顯示...任何幫助嗎?
你好,感謝你的幫助,它顯示的CSS在我的圖片,但圖片本身是不是** **顯示(還)。我在imageUrl上嘗試了一個console.log,並且未顯示。可能是什麼原因 ? – FrenchyNYC
你應該嘗試調試的是放置一個'console.log(url)'而不是imageUrl。如果你想調試imageUrl,你應該做'console.log($ scope.imageUrl)' – e666
我不好意思,我忘記了存儲。現在我遇到的最後一個問題是「文件」沒有定義。任何想法我怎麼能有這些數據? 否則一切正常;) – FrenchyNYC