国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

使用React Native Expo將多個映像上傳到Firebase集合和Firebase
P粉226642568
P粉226642568 2024-04-04 23:20:02
0
1
1901

我正在嘗試使用React Native“expo”將多個圖像上傳到Firebase存儲和Firebase數(shù)據(jù)庫集合,但這很困難,我什至嘗試使用chatGpt,但生成的代碼令人困惑並且不知何故過時,因此它不起作用在此處輸入圖像描述

P粉226642568
P粉226642568

全部回覆(1)
P粉322106755

我為此寫了一個函數(shù)。這裡是:

import { ref, uploadBytes, getDownloadURL } from 'firebase/storage'
import { auth, storage } from '../../config/firebase'
export async function uploadImage(uri) {
try {
    const response = await fetch(uri)
    const blobFile = await response.blob()

    const image_name = 'image_name'
    const metadata = {
        contentType: 'image/jpeg',
        customMetadata: {
            from: auth?.currentUser?.uid
        }
    }

    const reference = ref(storage, image_name)
    const result = await uploadBytes(reference, blobFile, metadata)
    const url = await getDownloadURL(result.ref)

    return url
} catch (err) {
    return Promise.reject(err)
}
}
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板