Yes, it's not hard.
Assuming that you are using
<img src="getImage.asp?id=73" /> you would need to do
Code:
<%
' make sure that the < in the above line is the FIRST CHARACTER in the ASP page!!!
'
' what image was requested?
imageid = CLNG( Request("id") )
... here you need to go find the image to match the imageid ...
... we will assume that you find some FILENAME, here called fname:
fname = ... you supply this code ...
' Set the content type to the specific type that you are sending.
' Find the extension of the fname, thus:
period = InStrRev(fname,".")
If period = 0 Then Response.End
fext = Mid(fname,period+1)
' Then tell the browse what the type is:
Response.ContentType = "image/" & fext
Set strm = Server.CreateObject("ADODB.Stream")
strm.Open
strm.Type = 1 ' binary stream
' assuming fname is *RELATIVE* to the current directory:
strm.LoadFromFile Server.MapPath(fname)
' (omit the Server.MapPath if fname is already a full Windows path!)
Response.BinaryWrite strm.Read ' write the entire image out to the browser
strm.Close
Set strm = Nothing
Response.End ' important!
%>