I have a simple phototaking android app that allows the user to take a photo and save it. I allow the user to create multiple versions of the photo in the app – adding captions, filters, etc. After the user is finished, I upload the photo to Firebase storage. Here I upload a few files
- The original raw bitmap that was taken using the camera
- The finished bitmap with all edited captions and filters applied
- The thumbnail of the the raw bitmap, and finally
- The thumbnail of the finished image
The thumbnails and the full size images allow users to undertake future interactions with the app.
What would be the most efficient way to upload the images? Options that I know of are
- Using 4 different upload tasks from the Android app. But this is taking a few seconds to finish all 4 uploads.
- Using 2 upload tasks for the fullsize images and then using Firebase ‘functions’ to create the the thumbnails in the server. However, I would need to create the thumbnails locally in the app for display purposes before uploading, so it would mean creating the thumbnail in 2 places – app and the server. Also it would mean doing double error handling – one at the server side and the other on the app end.
- Is there any other option?
Looking forward to whatever help I can get. As usual, feel free to ask for clarifications, via comments.
That depends on your scenario. If you are on “Spark” plan then using firebase functions too much might exceed your free quota of:
- Invocation (125K/month)
- GB-seconds (40K/month)
- CPU-seconds (40K/month)
But if you can upgrade to “Flame” or “Blaze” then it won’t be an issue and its the preferable way.
On the other hand, thumbnail file aren’t too big that takes much time for uploading, unless you are on extremely slow connection, then uploading thumb files from app won’t be an issue. You might not even notice the uploading time. It will be quick.