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

Response.BinaryWrite rs("image_data") wont change image

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
0
0
US
I have the following link in an asp page:

do while loop
<TD BGcolor =&quot;f7efde&quot; align=center>
<font style =&quot;arial narrow&quot; size=1>
<IMG SRC=image.ASP width=190 height=240>
</font>
</TD>
rs.movenext
endloop


image.asp does a response.binarywrite.. everything works ok as long as there is only one image. However if there are 6 images, the page displays 6 images but they are all the first image in line. In other words the img src does not refresh on each loop, it grabs the first image and holds that for each trip through the loop.

hope this makes sense, but I need to know if there is some way to &quot;refresh&quot; the image so the image actually changes on each loop.

 
The image source tags are not diiferent, so on the second (and 3rd, 4th..) it looks in the cache.

Try adding a parameter to the query string

counter = 0
Do Loop code

counter = counter + 1
<img src=&quot;image.asp?image=<%=counter%>&quot; width= etc..

even if you don't do anything with the value passed, it should make the src attributes unique.


cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
Or another thought, since the parameter really is relevant other than creating uniqueness, use the current date and time.. that way even on a refresh you guet unique names each time. cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
my recordset already has a unique identifier for each photo. As i loop through the recordset each loop changes the image_id. the <img src=image.asp> file (image.asp) is supposed to bring up the image= image_id, but it hits the first image and that same image is in each table row, never changes....so I think, just like in your loop, the parameter passed is always unique....

 
This tag: <img src=image.asp> goes to image.asp for the image, the second time it wil still go to image.asp, if this file is on the client/proxy machine (cached) and not expired yet it will not even bother the server in asking for it.
So you could do something like this:
<img src=image.asp?makeUniqueUrl=<%=now()%>>
 
Oh sorry, I realize you should use ChrisQuick's counter as wel:
<img src=image.asp?makeUniqueUrl=<%=now() & counter%>>
 
Another thing I don't get is how does the image.asp know what image to display.
Apart from the fact that you do not provide a unique url so it won't display changes if the user visits the site the next day you do not let the image.asp know what the image is it needs to display.
<img src=image.asp?makeUniqueUrl=<%=now() & counter%>&imageToDisplay=<%=rs(&quot;imageID&quot;)%>>
 
In my loop i set a variable for the rs.image_id for each record and image.asp uses that image_id to select the correct image...

Ill see if I can work the link like above and see if that refreshes...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top