tags:

views:

66

answers:

2

Stored in the database or file system ?

And I need several different sizes. like 128*128, 96*96, 64*64 and so on.

What is the best way to upload user portrait?

+1  A: 

Not knowing all of your constraints, I'd upload the 128x128 picture and then create all the other portraits on the fly.

I don't think you need to worry about storing the images in the DB, specially if you're running SQLServer 2008 (and you use the new FILESTREAM type).

Esteban Araya
Thanks for your reply. I want to know if the user uploaded photo size is 400x300. do you will re-size photos to 128x128?
Gordian Yuan
@Gordian: Yes, I'd re-size to 128x128 before I store it.
Esteban Araya
A: 

Definitively it depends of the amount of images you need to store.

If you store them in the file system you just need to keep the URL or location of the image the database. To change the size you can do it in real time using components to achieve the change depending of the language you're using. For .NET ASPjpeg is a very good one, but you can manipulate the image with the System.Drawing.Imaging class. No need to manipulate database filestream or BLOB fields.

In the other hand, storing images in the database can make it too big in order to backup or download depending of the amount of records, even if you are working with SQL server, but you have everything in the same place. Maintenance is faster.

The problem with storing images in the file system is the cleaning procedure, if you delete a record, you need to delete the image in the file system too in order to prevent of keeping garbage.

backslash17