How can i get the URL of a image selected from Image picker?

I am working on a Math game. I want to add a option to change profile picture from Firebase, but it accepts only the URL of the image, so how can i get the URL of that selected image? Please reply as soon as possible.

Your request is unclear...

Do you want the url of the image from Firebase or the url of the image in the image component in your app? If the former, are you storing your images in Firebase Storage? If selecting a local image, then there will be a file path or content uri, not a url. You cannot pick remotely stored images with the imagePicker, you would need to make a list of urls and select from that.

I want the url of the image from Firebase and yes, i am storing that image in Firebase Storage.

If you know the directory location then you can use this, along with the filename. For example:

Directory:
https://firebasestorage.googleapis.com/v0/b/myProject.appspot.com/o/ProfileImages%2F

Filename:
greenSquare.png

Full Url:
https://firebasestorage.googleapis.com/v0/b/myProject.appspot.com/o/ProfileImages%2FgreenSquare.png

1 Like

If am not wrong i have to just join the Directory with file name, and i will get the URL. Thanks for Reply!

  • Upload file with putFile() (if Android) or putData() (if web).
  • Call getDownloadUrl() on the uploaded file’s reference.
  • Save that URL in your DB (e.g. Firestore/Realtime DB) and load it in your app.
1 Like

if it helps thats pretty good but if not then im also seeking help from the comunity

what help do you need ?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.