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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with pictures

Status
Not open for further replies.

timdodgson

Technical User
Jun 12, 2000
111
GB
Hi lads and girls
First off this is all very new to me so please be jentle

Anyway i have an access database (97 format) with pictures inbeded in it, i am trying to show these pics via my website i can pull text from database but not the pics

Thanks in Advance
Tim dodgson


Tim Dodgson
timdodgson@yahoo.co.uk
 
for images, you need to use a separate include page that put out the required jpeg headers

usually done like this

Code:
<img src="/path/to/show_image.asp?id=<%=image_id%>">

the show_image.asp might be something like this (not complete):
Code:
'get the user id
user_id = Request.QueryString("id")

'Read in the image from the database
Set objRS = objConn.Execute("SELECT Picture FROM TableName WHERE ID = " & user_id)

'Set the ContentType to image/jpeg
Response.ContentType = "image/jpeg"

'Send the binary bits to the browser
Response.BinaryWrite(objRS("Picture"))

Bastien

Cat, the other other white meat
 
Bastien is correct but s/he hasn't really explained the issue.

To store an image in a database you use a BLOB field. Apart from making BIG databases, my observation is that it slows them down.

Preferable is to only store the filename and keep the image file in its own folder.

Then using Bastien's technique, or something similar, when you pull the record, you put the jpeg display code in front of the filename.

You can either store size info at the same time if you want or find some code that will determine image file for the script.

Steve Davis
hey.you AT HaHaHa.com.au

Me? I can't even spell ASP!

NOTE: This sig does not include any reference to voting, stars, or marking posts as helpful as doing so is cause for membership termination
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top