E
E
ellz2019-02-25 20:35:23
Web development
ellz, 2019-02-25 20:35:23

What is the best way to store images in MSSQL database?

There is a web api on .net core 2. During the request, the procedure should be executed and return the image from the database. The response to the client comes in JSON format. Which way is better, store the image in VARBINARY or store the images in the Resours folder, and only the path to the image in the database (then sign the server address to the path)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Shumov, 2019-02-25
@ellz

Store images in the cloud (s3 or s3 compatible) and link base

R
Roman, 2019-02-26
@procode

Second.
Storing references - easier and faster
In fact, the real need to store binary data in the database is not such a frequent occurrence. You can usually get by with links.

E
Evgeny Gribkov, 2019-03-13
@jobgemws

Two options:
1) links as written above
2) binary sequences (the second is needed if the database is constantly moving somewhere or the total weight of all images is small enough compared to all other data inside the database itself). It also makes sense to consider the second option, if you store not just a picture, but something like object recognition in a picture, then it's easier to keep everything together.
And do not forget that with the first option, you will need to worry not only about backups, but also about the consistency of these copies with the backups of the database itself. So that it does not happen that when restoring the database in another place at a certain point in time, the links were to completely different images

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question