firebase-storage

Getting images from firebase storage and rendering them with a map function

眉间皱痕 提交于 2021-02-20 04:23:10
问题 I current have a folder in my firebase storage that looks like this: enter image description here I am trying to map through a cloud firestore collection and rendering a screen with list items that have the corresponding info and the image. My document field include IDs that have 0 and 1 for example so I have an easier method of finding the images that I have on firebase storage folder. This is the code I'm using to render: renderAccordion() { return this.state.accordionarr.map((item,index) =

Firebase rules: dynamically give access to a specific user

前提是你 提交于 2021-02-19 02:31:12
问题 I'm building an Android app which requires me to store some pictures for the user. Let's say I have 2 users: A and B. They should be able to read / write on their specific folders: user A can read and write to bucket/images/userA and user B can read and write to bucket/images/userB. They should not have access to anything else. Now let's say user A uploaded picture1.jpg and picture2.jpg. How can user A grant access to bucket/images/userA/picture1.jpg to user B? User B should not have access

Dynamic Image resizing for firebase storage

旧街凉风 提交于 2021-02-18 10:41:34
问题 Is there an efficient method to serve dynamic size images stored in firebase storage through changing Query parameter in image URL? Or something like Imgix? what is the most efficient method? 回答1: I recommend You try this Cloud Functions for Firebase Storage resizing using ImageMagick Writing a Cloud Storage Trigger with Cloud Functions for Firebase sample code generate thumbnail 回答2: I use the following technique on my firebase project to do just what you are asking. Google cloud has a

How can I access a specific folder inside firebase storage from a cloud function?

怎甘沉沦 提交于 2021-02-18 08:40:08
问题 I am using firebase cloud function storage for the first time. I succeeded to perform changes on the default folder by using : exports.onFileUpload = functions.storage.bucket().object().onFinalize(data => { const bucket = data.bucket; const filePath = data.name; const destBucket = admin.storage().bucket(bucket); const file = destBucket.file(filePath); but now I want the function to be triggered from a folder inside the storage folder like this How can I do that? 回答1: There is currently no way

Cant get Firebase Storage security rules to refuse access to a file

做~自己de王妃 提交于 2021-02-16 18:50:08
问题 I'm sure I'm missing something wrt Firebase Storage rules, but I've done the following: STEP 1 Firstly I set the following Firebase Storage rule: service firebase.storage { match /b/{bucket}/o { match /items/{dev_key}/{perm_id}/{file_name} { allow write: if request.auth.uid == dev_id; allow read: if request.auth.token.permId == perm_id; } } } I expected only signed in users with a custom claim permId matching the relevant location to be able to download the file, allow read: if request.auth

Upload Image to Firebase Storage with the current users UID

落花浮王杯 提交于 2021-02-15 07:44:15
问题 How do you upload an image that will also have the current user's UID attached? Example below. This is the code I am using to upload the image, but so far having no success adding on the UID. private void updloadImage(Uri pickedImage){ StorageReference myStorage = FirebaseStorage.getInstance().getReference().child("users_photos"); final StorageReference imagePath = myStorage.child(pickedImage.getLastPathSegment()); userID = fAuth.getCurrentUser().getUid(); imagePath.putFile(pickedImage)

Upload Image to Firebase Storage with the current users UID

与世无争的帅哥 提交于 2021-02-15 07:44:01
问题 How do you upload an image that will also have the current user's UID attached? Example below. This is the code I am using to upload the image, but so far having no success adding on the UID. private void updloadImage(Uri pickedImage){ StorageReference myStorage = FirebaseStorage.getInstance().getReference().child("users_photos"); final StorageReference imagePath = myStorage.child(pickedImage.getLastPathSegment()); userID = fAuth.getCurrentUser().getUid(); imagePath.putFile(pickedImage)

Upload Image to Firebase Storage with the current users UID

回眸只為那壹抹淺笑 提交于 2021-02-15 07:43:36
问题 How do you upload an image that will also have the current user's UID attached? Example below. This is the code I am using to upload the image, but so far having no success adding on the UID. private void updloadImage(Uri pickedImage){ StorageReference myStorage = FirebaseStorage.getInstance().getReference().child("users_photos"); final StorageReference imagePath = myStorage.child(pickedImage.getLastPathSegment()); userID = fAuth.getCurrentUser().getUid(); imagePath.putFile(pickedImage)

Firebase storage: download images to and put to img src in React map

╄→尐↘猪︶ㄣ 提交于 2021-02-13 17:37:48
问题 I'm trying to map array to get image url from Firebase storage and list them to page. The code give me a url, but the problem is that code not set url to img variable on time and returning empty img variable. return( <div> <Header /> {this.state.loaded ? <Loading /> : null} <div> {this.state.productsArr.map((product, i) => { let img = ''; storageRef.child(`images/${product.images[0]}`) .getDownloadURL() .then((url) => { img = url console.log('then img', img) }) .catch((err) => console.log(err

Firebase storage: download images to and put to img src in React map

 ̄綄美尐妖づ 提交于 2021-02-13 17:34:18
问题 I'm trying to map array to get image url from Firebase storage and list them to page. The code give me a url, but the problem is that code not set url to img variable on time and returning empty img variable. return( <div> <Header /> {this.state.loaded ? <Loading /> : null} <div> {this.state.productsArr.map((product, i) => { let img = ''; storageRef.child(`images/${product.images[0]}`) .getDownloadURL() .then((url) => { img = url console.log('then img', img) }) .catch((err) => console.log(err