Forum Moderators: open
Not a good idea to store the jpg in the database itself or you will very quickly suffer from database bloat. A better approack is to store the JPGs in a dedicated folder and then simply enter the filename in the database. Then you can call the filename from the database and code it the same as you would any image. Much Muih Much quicker.
Onya
Woz
I may change my mind in the future, but I'd like to try it this way first, and I'm getting really frustrated that I can't find any examples that will show me how to do it. I've been searching for a few hours now and looked through all my ASP.NET and VB.NET manuals and can't find anything.
strHTML = strHTML & "<img src=" & q& "images/" & rs("cimageurl") &q& " align=" & q& "left"& q & ">" & vbcrlf
This would much quicker and would not create database issues.
Let me know if you would like some sample code.
TravelSite, what db are you using and what is your experience with performance using both methods?
we use MS SQL and have used Access in the past. The only method I've used is storing the pathname - simple for Access/SQL. I've looked into storing the images in an sql database but, on advice from our Database Developer, aren't doing this just yet. Her opinion is NOT to do it until you really need to. We won't really need to for another few months.
If there are good reasons to do it then I'd just say that, in my experience, a good server and sql can handle and process a LOT of data and cope with lots of traffic (and get feedback/help from your hosting company if possible). There's no harm in trying the method (let us know how you get on if you do it!).
If its for an admin related task then you may find some suitable scripts on the web that make uploading images to the webserver, and inserting the filename in a database, straightforward for clients. Again, if you get on with your hosting company they can help you with setting up access privilages so that clients can upload/delete from a directory.
response.binaryWrite objRS("binImage")
I would agree with everyone else and not store BLOBS in a database.
Another way is to just use the product key to name the images, then you dont need to store anything in the database :
Response.write "<img src=products/" & objRS("ID") & ".gif>"
<added>
Just found the info -
HOWTO: Display Images Stored in a BLOB Field [support.microsoft.com]
</added>
Don't forget that it is very unefficient and your database will grow rapidly depending on the amount of images.
However if you really want to do this try this site it shows how to add a binary image to a database
[stardeveloper.com...]