How to store and view images on firebase?
相关问题
- adding sha1 in firebase app fails with error
- firebase storage cors strange Behaviour
- Firebase security rules difference between get() a
- LoginActivty with Firebase & Facebook authenticati
- How to add working directory to deployment in GitH
相关文章
- How can make folder with Firebase Cloud Functions
- Firestore Update a document field Using Rest API
- How to convert a FCM token to APNS token?
- App not showing Notification receiving FCM when th
- Android Studio - Get Firebase token from GetIdToke
- How to combine Firestore orderBy desc with startAf
- Remove Duplicates from an Array of GeoFire Objects
- Is it possible to test a Firebase trigger locally?
Yes you can store and view images in Firebase. You can use a filepicker to get the image file. Then you can host the image however you want, i prefer amazon s3. Once the image is hosted you can display the image using the url generated for the image.
Hope this helps.
You can also use a service called
Filepicker
which will store your image to their servers and Filepicker which is now called Filestack, will provide you with a url to the image. You can than store the url to Firebase.I ended up storing the images in base64 format myself. I translate them from their base64 value when called back from firebase.
There are a couple of ways of doing I first did the way Grendal2501 did it. I then did it similar to user15163, you can store the image url in the firebase and host the image on your firebase host or also Amazon S3;
Update (20160519): Firebase just released a new feature called Firebase Storage. This allows you to upload images and other non-JSON data to a dedicated storage service. We highly recommend that you use this for storing images, instead of storing them as base64 encoded data in the JSON database.
You certainly can! Depending on how big your images are, you have a couple options:
1. For smaller images (under 10mb)
We have an example project that does that here: https://github.com/firebase/firepano
The general approach is to load the file locally (using FileReader) so you can then store it in Firebase just as you would any other data. Since images are binary files, you'll want to get the base64-encoded contents so you can store it as a string. Or even more convenient, you can store it as a data: url which is then ready to plop in as the src of an img tag (this is what the example does)!
2. For larger images
Firebase does have a 10mb (of utf8-encoded string data) limit. If your image is bigger, you'll have to break it into 10mb chunks. You're right though that Firebase is more optimized for small strings that change frequently rather than multi-megabyte strings. If you have lots of large static data, I'd definitely recommend S3 or a CDN instead.
Using Base64 string in JSON will be very heavy. Parser has to do lot of heavy lifting. Currenlty Fresco only supports base supports Base64. Better you put something on Amazon Cloud or Firebase Cloud. And get image as a URL. So that you can use Picasso or Glide for caching.