fine I don't need help...
I didn't have the option of keeping the images in a directory and keeping the paths in the database. The database HAD to contain the images in an image datatype field. So for those of you who have struggled with this... here is how you do it. I spent the day at the library figuring this out but its actually kinda simple and works like a charm:
First you create an asp file to obtain the image:
Code:
<% @LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<%
dim iPictureID
iPictureID = Request("PictureID")
dim objConn
set objConn = server.createobject("ADODB.Connection")
objConn.ConnectionString = "Provider=MSDASQL.1;Password=mypassword;Persist Security Info=True;User ID=myuser;Data Source=mydatasource;Initial Catalog=mytable"
objConn.Open
dim objRS
set objRS = server.createobject("ADODB.Recordset")
objRS.ActiveConnection = objConn
dim strSQL
strSQL = "select image from images where image_number = " & iPictureID
objRS.Open strSQL
if not objRS.EOF then
response.contenttype = "image/jpeg" 'defines type of data
response.binarywrite objRS(0) 'writes the data
end if
objRS.close
objConn.close
set objRS = nothing
set objConn = nothing
%>
Then you create a file to request the image: (this one is easy)
Code:
<%
response.write "<IMG SRC=""getpicture.asp?pictureID=" & "123456" & """>"
%>
And you display the picture from your database under the 123456 key!!