0

I'm making an app with react native and spring boot for backend, what is the best way to save images? Is it fine to get compressed base64 string from image crop picker and save it in the database?

I test it and it works. I chose 10 MB image and when it saved after compressing, it becomes 182kb and i test the fetching speed and its fast. so is it fine to do that? If not, what should i do?

i know i should upload the image in a folder in the server and put the path in the database but then what ? In React Native you cant put path for image as variable like:

<Image source={require(x) } />

and x is the saved path in database, i know that the hole thing "require (/path/image name)" must be a variable to work but if i put in the database it doesn't work because it will be saved as string but it must be jxe to work so what is the solution?

Samitha Nanayakkara
  • 2,529
  • 2
  • 10
  • 23
YUGI DSOD
  • 1
  • 1
  • Can you please separately explain your questions? With some code if necessary? – Samitha Nanayakkara May 26 '20 at 18:49
  • Iam making app that use react native and spring boot. The question is: i want the user to choose a photo and i want to store it and display it so every other user can see it, so how should i save the image? Is it good to save the compressed base64 string in the database? – YUGI DSOD May 26 '20 at 21:04

0 Answers0