I was wondering how to store Images inside Firestore Database instead of the storage and how can I retrieve the Images.
Asked
Active
Viewed 289 times
1
-
This might help you https://stackoverflow.com/questions/30645953/convert-a-jpg-file-to-utf-8-without-making-it-corrupt – Mises Jan 16 '22 at 09:18
-
Remember firestore max doc size is around 1MB. – Mises Jan 16 '22 at 09:18
-
Hi, Why do you wanna store images in Firestore database? I believe that it is not a good practice to store images in the database, it is not a cost effective way, also the size limit of a document is 1MB in Firestore. Read [storing images in Firestore](https://www.reddit.com/r/Firebase/comments/i4im1y/storing_images_in_firestore/), let me know if it helps? – Zeenath S N Jan 16 '22 at 12:46
1 Answers
0
Firestore only stores JSON data. You have to host your image somewhere in order to display it. You should use firebase_storage for storing that image.
Future<String> getImageUrl() async {
Reference ref =
FirebaseStorage.instance.ref().child('pathToImage');
String url = await ref.getDownloadURL();
return url;
}

Hrvoje Čukman
- 421
- 4
- 12