'Uploading and resizing images with Firebase, Expo React Native

What is the recommended Image upload and resize approach with the below Tech Stack :

  1. Firebase (Cloud Firestore, Cloud functions, Realtime Database, Cloud storage)
  2. Expo React Native

I am wondering if anyone has insight on this in regards to performance, efficiency etc.

Here’s what we’ve tried

  1. Upload Image function with this (https://github.com/expo/expo/issues/2402#issuecomment-443726662) + Expo Image Manipulator. All this on the front end
  2. fetch apiUrl endpoint with formData + busboy https onRequest with with ImageMagick resizer (backend)
  3. Allowing user to upload image of any size + onFinalize() backend cloud function with ImageMagick resize and then update path of image and finally delete old image later ?

Which is highly recommended ? Are there alternatives ? Please me know.



Solution 1:[1]

The first recommendation I'd make is to not consider any of the products you mention for storing images, but instead use Cloud Storage (for which a Firebase SDK is also available).

The simplest way to then resize the image after it's been uploaded is through the Resize Images extension that Firebase providers. The extension is just a pre-built set of Cloud Functions, so if you want different behavior you can always fork its code and roll your own based on that.

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 Frank van Puffelen