Fido
Fido

Reputation: 595

Storage image file to server

I'm developing a travel app. It has places which have images.

I have a database on my own server. My app reading image from that server database.

I'm confused between 2 choice for storage image:

  1. Store the link of image on database. When app reading, download that image then display it

  2. Store the encoded image on the database. When app reading, decode image and display.

which choice is better?

Upvotes: 0

Views: 177

Answers (1)

StarsSky
StarsSky

Reputation: 6711

It depends on different factors, such as image size and possibility to store in web-app folder of the server. For ex: if your server has a public folder http://server/public and you have large images, you can store the image there and the URL path on the DB. The app read the uri of the image and displays it. It's the faster solution. But if you haven't a public folder and you have little images, you can store as base64 image as a Blob object inside your database, and then get, decode and show the image on your app. It all depends on different factors.

Upvotes: 1

Related Questions