Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advice required: How to store images

Status
Not open for further replies.

SonJ

Programmer
Oct 24, 2002
166
GB
Hi there,

I am building an application that requires for pages to be dynamic. There are several images to be used on a page and I would like to know where is the best place to store them.

I have been reading about the following options:

1) How to store the image in the database table as a BLOB field

2) To keep the images in a folder called "Images" and then store the link to the image in a field in the database table.

Does anyone know about the pros/ cons of either of these methods? I am assuming that the second method would involve less development work and hence, be faster to implement, which is also an important consideration.

Any ideas/ suggestions/ alternatives would be much appreciated.

Thanks in advance.

SonD
 
I use the second one - no problems.
Then in the code
src=&quot;images/<%=(pics.Fields.Item(&quot;images&quot;).Value)%>&quot;

You have to tell it where the photos are stored (usually 'mages')and then add the code that finds the records from the DB
Hope this helps
 
Thanks for that, I was inclined to go that way too as time is of the essence!

SonD
 
This also cuts down on your communications time and possible image errors. When you store the image as a BLOB in the database you have to know exactly what kind of file it is (differant image types have differant encoding, differant size header, etc), etc. You are also incurring a double transmission penalty as the data for the image has to be transferred from the database to the server, and then from the server to the client (and this is without counting the additional time to actually BinaryWrite the file to the Response buffer).

I have found that saving links is generally better as long as you don't decide to move the images to a new folder without updating the table.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
 
Thanks for your advice Tarwn. I have decided to go for the second method for defo now. Most informative!

SonD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top