问题
I have 10,000 full sized images so each image is about 4MB.
I want to display images in android app by using firebase storage
and database
and recyclerview
.
My question is
Case 1. Do I have to save reduced sized images in firebase storage?
Case 2. Do I just save original big sized images in firebase storage and loading low quality small sized images?
I have already implemented the Case 1 with Glide. This is not a problem. What about Case 2? Does it work?
回答1:
Case 1. Do I have to save reduced sized images in firebase storage?
Its totally depends upon you . you want to save original file or scale down image . But consider following facts .
- You need more storage for Original Size (paid plan after threshold)
- More Server bandwidth will be utilise for large Images
- user's Internet Data. (will consume more data for large images)
Case 2. Do I just save original big sized images in firebase storage and loading low quality small sized images?
there are two cases
- In firebase you need to store two types of images . (Thumbnail and Original image). so first load thumbnail and if user choose to download. then get original image.
- You can scale down image at the time of loading in view with Glide or Picasso you can resize images easily.
回答2:
Though it varies from case to case and I believe/assume with 10,000 images you are making an app whose primary feature is its photos.
Save the full sized images. Since user won't see all 10,000 at same time, you should also explore Paging Library from JetPack. Here is the link https://developer.android.com/topic/libraries/architecture/paging.html
Show/Load only the ones that are required. Optimization here will be the trick.
回答3:
Firebase will be paid on bandwidth, they are free up to some of the limit of bandwidth, so if you use more images(10K) with the low size or high size. You need to upgrade your firebase plan if the user loads that images.
The solution is that you should purchase any server with low cost and upload all images with various dimensions such as Thumbnail, medium, large, and original size, so it will be helpful for every condition to load fastly.
来源:https://stackoverflow.com/questions/56880154/proper-way-to-handling-images-in-android-by-using-firebase