There are many times that I wanted to save an image to an SQL Server. I have read some practices for saving images :
1) upload and save image to server, save the path inside the table
2) save image as binary
3) save image as base64 string
4) using BLOB(i haven't researched how it works)
Do you know which "way" is faster when you request from server an image? Do you know which "way" is better so as not to make SQL server slower? Do you know any other "way" which is better from the above?
Thanks!
Microsoft has done some research on this topic and has concluded that it depends on the size of your image. If most of your images are < 256Kb, you should probably use VARBINARY. On the other hand, if they are above 1Mb, then you should use a FILESTREAM (which is usually stored on the filesystem outside the database file).
If your images are linked to other data, it's often useful to separate the records itself from the images into different tables (i.e. create an Images table) so that the table with the data remains small and easy to manipulate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With