Search code examples
androidfirebasekotlingoogle-cloud-platformfirebase-storage

Create a database with my local images with Firebase


First of all, I would like to say that I am a beginner in the development of applications and the use of firebase.

I would like to create packages containing sets of vector images but I do not see in the documentation how to do it.

Indeed, in the Realtime Database section, there is no "picture" type. I saw that I could add some to the database via the storage. But again, it is only images generated for the user in the application.

The last option I thought of was to use the cloud functions. Again, I feel like I can't trigger anything without it pre-existing in the application.

What do you think about it? Can I still use Firebase to get the result I want?


Solution

  • Indeed, in the Realtime Database section, there is no "picture" type.

    The Realtime Database is a cloud-hosted NoSQL database that lets you store and sync data between your users in real-time. So it's not a product that can help you store images.

    I saw that I could add some to the database via the storage. But again, it is only images generated for the user in the application.

    Yes, Firebase Cloud Storage is a service that can help you store any type of file, including vector images. In order to be able to access those files, you need to know the URLs of the files. So it's best to store those URLs, either in Cloud Firestore or in the Realtime Database for later use. Since you tagged your question with Kotlin, I think that the following resource will definitely help:

    Where I have explained how you can upload a file from your local device to Cloud Storage, get the download URL, and display the image using Jetpack Compose. Here is also the corresponding repo.