Best Way To Store User Images

Best Way To Store User Images
0
#1

Hey guys, I’m hosting an app where amongst the main features is storing and displaying a lot of image data. I’m hosting this application off of hostinger (not sure whether or not that’s a bad idea). My app is very simple; it’s stored on a single server with a single database. The images are all stored as longblobs on the database. It takes forever to even load a single image.

My question is: what is the best way to handle so many images? How do I store them and retrieve them for client use? How do other apps do this so well, and what are the pros and cons of storing the image data in a database vs as files somewhere on the actual server?

In other words, if I started from scratch, what would you recommend that I do and why?

Thanks

0 Likes

#2

Storing in the database is easy to manage. You can chose this if your images are small. Otherwise it become a backup problem.

Storing in the file system is better when the images are bigger. But this requires some sort of interaction with the file system. Normally the database it self cannot do this so you have to add an extra layer to store and grab files. Like a document managment system. To speed up the transfer from server I should look at gRPC (10 to 100 times faster)

FWIW

0 Likes

#3

so it’s an image hosting app like flickr or imgur?

probably go with a cloud server. putting everything in a single database is a pain to back up

well just my 2 cents.

0 Likes

#4

Why???

Store the filepath/url to the image in your database.
Store the image as plain jpg or png files.

Database storage is expensive too.
Filesystem space is cheap…

You can even store images to AWS cloud, and just store the image url in your database.

1 Like