1

i am wanting to grab the image uri, upload it to firebase in order for it to be available there and other users r able to see this image when connecting to the firebase database. only issue is when an image is selected, firstImage is set as content://com.android.providers.media.documents/document/image%3A525 which doesn't have the extension, whether it's .png, etc.

the logic below is done in a composable function which is y something like gallery intent isn't used.

any insights?

        var firstImage by remember { mutableStateOf<Uri?>(null) }

        val firstLauncher = rememberLauncherForActivityResult(contract = ActivityResultContracts.GetContent()) { uri ->
            uri?.let { firstImage = it }
        }
raazza
  • 109
  • 7
  • what you need is real path of file, which is not correct. Try this to get real path of File https://stackoverflow.com/a/41520090/19491703 – Beant Singh Jul 12 '22 at 04:28
  • 1
    That isn't a valid URL. That's the reason why you cannot display anything. Besides that, there isn't enough information in your question so we can help. Please make it more clar. However, I think that this [resource](https://medium.com/firebase-tips-tricks/how-to-upload-an-image-to-cloud-storage-and-save-the-url-in-firestore-42711ca1df46) will definitely help. – Alex Mamo Jul 12 '22 at 07:12

0 Answers0