'Upload image to firebase realtime Database or storage?

I am trying to upload images to firebase along with other string and double data type.

I am think about 2 options now, one is uploading the imageUrl to firebase Realtime Database and when I retrieved it, I will retrieve a imageUrl and convert it to image.

Another way is to upload the image file to Firebase storage.

Which one is the preferred one to do? From the speed of loading image? or other factors that I haven't thought of.

Thank you for your help! I appreciate it.



Solution 1:[1]

Upload image urls is a better option. Upload the image is a heavier task, hence it is better to upload urls with other data.

Solution 2:[2]

It depends on how big your app is going to scale. However, storing a large binary files in real time database is not a good practise. I would suggest you to use cloud storage, usually AWS buckets to store images and save the URL to firebase, to retrieve it later.

Solution 3:[3]

Storage is given from firebase to store all your large data and then fetch asynchronously. So using storage should be a better way rather than database.

Solution 4:[4]

For any kind of file you must have to use storage, and then store only file name in your realtime database to maintain good performance of your application. And that is the main reason firebase provide those functionalities in separate ways.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anirudh Bagri
Solution 2 toxdes
Solution 3 Basir Alam
Solution 4 Dhaval Dobariya