javascript - 将图像数组上传到 Firebase 存储并返回其 url React Native
问题描述
我正在将图像上传到 firebase 存储,我对此没有任何问题,但是我拥有的引用将图像的名称返回到一个名为 imagesBlob 的数组中。我想在上传后返回每张图片的下载 URL 并将其放入该 imagesBlob 数组中。
我怎样才能做到这一点??
这是我的功能:
const uploadImagesStorage = async (imageArray) => {
const imagesBlob = [];
await Promise.all(
imageArray.map(async (image) => {
const response = await fetch(image);
const blob = await response.blob();
const ref = firebase
.storage()
.ref('provider-images')
.child(uuidv4());
await ref.put(blob).then((result) => {
imagesBlob.push(result.metadata.name);
});
}),
);
getImageUrls(imagesBlob);
};
解决方案
推荐阅读
- python - 在 python 中使用 os-preprocessor
- c# - 具有两个 ref 参数的 MethodInfo.Invoke 方法不起作用
- asp.net-core - 在我的网址中使用 www 时,在 aspnet 核心中出现 403 错误
- node.js - 以角度向用户显示假路线
- apache-kafka - kafka幂等生产者可以确保多个分区恰好一次吗
- html - 为什么我的搜索栏随着微调器移动?
- dialogflow-es - 如何将我的对话流连接到我的谷歌操作并在智能扬声器上进行测试
- javascript - 如何在一行代码中从单个对象中选择两个属性
- git - git 添加除一个子文件夹外的所有子文件夹和文件
- java - 使用 Javafx AnimationTimer 时如何获得瞬时 fps 速率