2
votes

Problem Statement:

I´am uploading an image uri base64 from my react-native app to my java backend server. My backend converts the URI String to a byte array and stores it in the MySQL Database (with a BLOB). So far it´s all fine! But when I'am reading/fetching the images from the database I convert them back to a base64 image uri string, to show them to the user (fetching with my Rest api). The problem is, that my Rest API (GET) can handle like 2-3 images and then it runs out of memory... What can I do? It´s because the base64 uri strings are obviously too long for the Rest API...

Any resolution?

1

1 Answers

0
votes

In your backend, you should store images as files, not byte array. Convert b64 to file in java with something like this (I don't personally know how to do it)

Once you've done this, your backend has to return you the file's url so you can display it in your app with the Image component from react-native.