我正在制作一个网页,并有一个问题,当尝试显示来自外部网站的图像。 var img = document.createElement("img");
img.setAttribute("width","50%");
img.src = img_url; 这在本地主机中工作得很好,但在使用firebase deploy和转到网站的url时得到403错误。 (可以确认图像url有效且正确) 有什么办法可以绕过这个问题吗? 这不是Getting 403 Forbidden error when trying to load image from Fir
我试图从我的火柴存储中获取一个图像,并将它添加到我的代码中。
我的守则:
loadImage() async{
//current user id
final _userID = FirebaseAuth.instance.currentUser!.uid;
//collect the image name
DocumentSnapshot variable = await FirebaseFirestore.instance.
collection('data_user').
doc('user').
collec
当用户可以登录时,我正在开发一个应用程序,在用户配置文件页面中,用户可以选择一个图像配置文件在我的应用程序中显示。此映像将上载到Firebase数据库中,并存储在Firebase存储中。我想用户可以决定删除他当前的图像配置文件,如果他想。我找不到方法去做,我如何从Firebase存储中删除他的图像,我使用元数据将其放入存储中。
下面是我在Firebase存储和Firebase数据库中上传图像的代码:
// Create a path in order to save the photo in Firebase Database
func setUser(img: String) {
v
我使用Firebase存储和实时数据库来存储图像和它的下载网址respectively.The文件名是在一个随机的方式生成下载网址,并保存到实时数据库。
场景:如果用户上传新的图像(例如配置文件图像),我想删除旧图像与downloadImageurl的帮助(下载图像url是在图像首次上传时生成的,相同的保存在实时数据库中).How旧图像可以删除吗?我已经尝试了下面的代码,但为了它的工作,我必须获得文件名。
gcs
.bucket("e**********.appspot.com") // find it in Firebase>Storage>
我可以从原来上传的文件下载url。
我无法从由图像大小扩展创建的文件下载url。
//making a ref beforehand
const ref = db.collection("impressions").doc().id;
//upload the original file
const bucket = await firebase.storage().ref("impressions/" + ref).put(image);
//this works but I do not need it
const downloadUrl