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

Pull Images from DB and display on page 1

Status
Not open for further replies.

sndkick

Programmer
Nov 1, 2000
71
US
I have images stored as BLOBs in my SQL Server DB in order to keep them more secure than leaving them in a web directory. I have a page that needs to pull data and images from the database and display them on the screen.

I am grabbing the image using

set oImg = rs.fields("photo").getChunk(16)

But how do I display this on the web? I have seen many samples of this done, but the examples I've seen set Response.Contenttype to "image/GIF". But if I do that, I get a "Header error... header mods must be made before writing page content..."

So I need to be able to loop through records in the DB, display some data and an image for each record.

Can someone give me a sample of this being done?

Thanks,
Scott

I need to
 
ignore that "...I need to."

sorry
 
Ive been trying to pull images from my oracle database using ASP. I got something similar to the above ms support article to work, but..... that works fine if I can provide ONE target_id... If I want to list three or four employees in a table, I can display the names, but they all have the same photo. the <img src=filename.asp> does not refresh on each iteration of the loop. How can I create a table of several employees with their names and photos?
something constructed like this:

<TR>
<TD BGcolor =&quot;f7efde&quot; align=left>
<font style =&quot;arial narrow&quot; size=1>
<%=RSNameList(&quot;id&quot;) & &quot; &quot; %>
<% target = rsnamelist(&quot;id&quot;)%>
' passing to oneimage.asp as a session variable
' so my select in oneimage.asp returns the right ID
<% session(&quot;mtarget&quot;) = target %>

</font>
</TD>
<TD BGcolor =&quot;f7efde&quot; align=left>
<font style =&quot;arial narrow&quot; size=1>
<%=RSNameList(&quot;last_name&quot;) & &quot; &quot; %>
</font>
</TD>
<TD BGcolor =&quot;f7efde&quot; align=left>
<font style =&quot;arial narrow&quot; size=1>
<%=RSNameList(&quot;first_name&quot;) & &quot; &quot; %>
</font>
</TD>
<TD BGcolor =&quot;f7efde&quot; align=left>
<font style =&quot;arial narrow&quot; size=1>
<%=RSNameList(&quot;middle_name&quot;) & &quot; &quot; %>
</font>
</TD>
<TD BGcolor =&quot;f7efde&quot; align=left>
<font style =&quot;arial narrow&quot; size=1>
<IMG SRC=&quot;oneimage.ASP&quot;>
</font>
</TD>


</TR>

' even though I movenext, the <img src=oneimage.asp> is
' always the same photo

<% RSNameList.MoveNext %>

<% loop %>

any suggestions, alternatives would be appreciated


 
>session(&quot;mtarget&quot;) = target

o your code snippet does not show how 'target' gets a value...

o Obviously your &quot;oneimage.ASP&quot; uses session(&quot;mtarget&quot;)
to retrieve the photo? Please show the code.


br
Gerard
 
actually I ended up by passing the variable...


the problem I cant seem to solve is in the code:

<TD BGcolor =&quot;f7efde&quot; align=left>
<font style =&quot;arial narrow&quot; size=1>
<IMG SRC=&quot;oneimage.ASP&quot;>
</font>
</TD>

after experimenting I found that the code works and oneimage.asp works fine in explorer 5.5, but on any explorer 5.0 machines you must hit the refresh button after the page retrieves, otherwise you do not get the updated photo. Its as if 5.5 has an auto refresh and 5.0 does not, but Ive compared the settings of machines with both versions and the settings are exactly the same. I upgraded a 5.0 machine that would not work to 5.5 and it began working. How can I get the page to refresh in all browser versions?

thanks for any help
 
I finally got my page to refresh even using explorer 5.0, I had to put a statement in my asp code to force a refresh..


finally!

thanks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top