|
 |
asp_web_howto thread: BinaryWrite
Message #1 by "Ken Lee" <tormented1_au@h...> on Mon, 15 Apr 2002 19:57:59 +1000
|
|
<html><div style='background-color:'><DIV><FONT face="Geneva, Arial, Sans-serif"
size=2>Hi all,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> The codes below works, CarImageOneS and CarImageTwoS are both binary string
stored within the database. The problem is, it can only show one picture at a time and I can only place the picture outside of the
HTML tags. Is there a way for me to make the pictures appear within the HTML tags?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> Thanks for all your help!!!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Ken</FONT></DIV>
<DIV><FONT face="Geneva, Arial, Sans-serif" size=2></FONT> </DIV>
<DIV><FONT face="Geneva, Arial, Sans-serif" size=2><</FONT><FONT face="Geneva, Arial, Sans-serif"
size=2>%@LANGUAGE="VBSCRIPT"%</FONT><FONT face="Geneva, Arial, Sans-serif"
size=2>><BR><%<BR> Set oConn = Server.CreateObject("ADODB.Connection")<BR> Set
oRs = Server.CreateObject("ADODB.Recordset")</FONT></DIV>
<DIV><FONT face="Geneva, Arial, Sans-serif" size=2> oConn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ="
& Server.MapPath("../cgi-bin/CarsForSales.mdb")</FONT></DIV>
<DIV><FONT face="Geneva, Arial, Sans-serif" size=2> sSQL = "SELECT CarImageTypeOne, CarImageOneS,
CarImageTypeTwo, CarImageTwoS"</FONT></DIV>
<DIV><FONT face="Geneva, Arial, Sans-serif" size=2> oRs.Open sSQL, oConn, 3, 3<BR>%>
<BR><% Response.ContentType = oRs(0) %> <BR><% Response.binarywrite oRs(1)
%><BR><html><BR><head><BR><title>Untitled
Document</title><BR></head><BR><body bgcolor="#FFFFFF"
text="#000000"></FONT></DIV>
<DIV><BR><FONT face="Geneva, Arial, Sans-serif"
size=2></body><BR></html></FONT></DIV></div><br clear=all><hr>Get
your FREE download of MSN Explorer at <a
href='http://g.msn.com/1HM501201/10'>http://explorer.msn.com</a>.<br></html>
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 19 Apr 2002 16:11:47 +1000
|
|
Think about a normal webpage. The images are separate files, and they need
to be retrieved separately by the browser.
In your .asp page you need to do something like:
<html>
<body>
<img src="getImage.asp?ID=1"><br>
<img src="getImage.asp?ID=2">
</body>
</html>
and the getImage.asp page extracts the image data from the database and
Response.BinaryWrites() it to the browser.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ken Lee" <tormented1_au@h...>
Subject: [asp_web_howto] BinaryWrite
: Hi all,
:
: The codes below works, CarImageOneS and CarImageTwoS are both binary
string stored within the database. The problem is, it can only show one
picture at a time and I can only place the picture outside of the HTML tags.
Is there a way for me to make the pictures appear within the HTML tags?
:
: Thanks for all your help!!!
:
: Ken
:
: <%@LANGUAGE="VBSCRIPT"%>
: <%
: Set oConn = Server.CreateObject("ADODB.Connection")
: Set oRs = Server.CreateObject("ADODB.Recordset")
: oConn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" &
Server.MapPath("../cgi-bin/CarsForSales.mdb")
: sSQL = "SELECT CarImageTypeOne, CarImageOneS, CarImageTypeTwo,
CarImageTwoS"
: oRs.Open sSQL, oConn, 3, 3
: %>
: <% Response.ContentType = oRs(0) %>
: <% Response.binarywrite oRs(1) %>
: <html>
: <head>
: <title>Untitled Document</title>
: </head>
: <body bgcolor="#FFFFFF" text="#000000">
:
: </body>
: </html>
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |