我将如何引用 firebase 存储中的图像?
How would I reference an image in firebase storage?
我将如何引用 Firebase 存储中的图像?我试图将它嵌入我的 html 中的 img 标签中。感谢您的帮助!
您通常会为此使用所谓的下载 URL。来自 Firebase documentation on getting a download URL:
storageRef.child('images/stars.jpg').getDownloadURL().then(function(url) {
// Get the download URL for 'images/stars.jpg'
// This can be inserted into an <img> tag
var img = document.createElement('img');
img.setAttribute('src', url);
document.body.appendChild(img);
}).catch(function(error) {
console.error(error);
});
我将如何引用 Firebase 存储中的图像?我试图将它嵌入我的 html 中的 img 标签中。感谢您的帮助!
您通常会为此使用所谓的下载 URL。来自 Firebase documentation on getting a download URL:
storageRef.child('images/stars.jpg').getDownloadURL().then(function(url) {
// Get the download URL for 'images/stars.jpg'
// This can be inserted into an <img> tag
var img = document.createElement('img');
img.setAttribute('src', url);
document.body.appendChild(img);
}).catch(function(error) {
console.error(error);
});