We are developing an E-commerce website using ASP.net and SQL server. The customer can view and order a wide variety of switches and light fittings.
As we need to display images of these products for each category, the number of images we need to display may rise to over 500. We are a bit confused by whether we should save these images as Image type in SQL, or whether it's better to store the path of the image. In the latter case, is storing all images under single folder better?
The following types are commonly used for images: Byte: An 8-bit unsigned integer ranging from 0 to 255. Pixels in images are commonly represented as byte data. Unsigned Integer: A 16-bit unsigned integer ranging from 0 to 65535.
The first is to store the file as a blob within the database. The second is to save the file (image, whatever) in a folder (which may be within the database folder structure) and then store the filename in a text field within the database.
The image
data type has nothing to do with images. I don't know why it exists. It is legacy.
Store the images like you would store any other blob: varbinary(max)
.
The issue whether to store blobs in the database at all has been discussed before. Note, that the answers there are very opinionated and subjective. It is clearly wrong to say that one should always store blobs inside out outside of the database.
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