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

view JPG & thumbnail from database?

Status
Not open for further replies.

Spyder1000

Technical User
Nov 2, 2004
109
US
I've got an access database which I pull data from using pretty basic ASP pages. I would like to add graphics to my pages to go along with each record set.

My fist thought was to put a link to a thumbnail in one coloumn and a link to the full size in another but after that i'm completely stuck. I've done some searching and didn't really see anythign that would help me.

if anyone has suggestions or examples i'd love some help.

thanks.
 
yes...that would be a good starting point...you display your records as you always did...but add a new column that displays the thumbnail image for each row...make this thumbnail a hyperlink and then when the user click it...open a new window(resize it) and show the complete image..and you can also have a close window link if you want...

let me know...i can provide some code to do it...

-DNG
 
yes please do. i'm strugling with how to turn my link in my table into a displayed thumbnail image on the webpage
 
here is the sample code:

Code:
<html>
<body>
<%
'declare variables
dim rs, conn, sql, userselection


'set all our objects
set rs=server.createobject("adodb.recordset")
set conn=server.createobject("adodb.connection")

'open connection string
conn.open "your connectionstring here"
'write our sql statement
sql = "your sql string here"

rs.open sql, conn

IF rs.EOF AND rs.BOF then
response.write "sorry, no records found"
else
%> 

<table border="1", cellspacing="1", cellpadding="1">
<tr>

<th>ImageThumbnail</th>
<th>FieldHeading1</th>
<th>FieldHeading2</th>
<th>FieldHeading3</th>

<% 
do until rs.EOF
%> 
<tr>
<td><a href= "#" ONCLICK = '[green]ViewFullImage[/green]("<%=rs("[red]imagethumbnailid[/red]")%>")'>rs("[blue]imagethumbnail[/blue]")</a></td>
<td><%=rs("field1")%></td>
<td><%=rs("field2")%></td>
<td><%=rs("field3")%></td>
</tr>
<%
rs.movenext
loop

    End If
rs.close
set rs=nothing
con.close
set con=nothing

%>
</table>

<script language="VBscript">
Sub [green]ViewFullImage[/green](ImageId)
Window.Open "[red]imagepage[/red].asp?ImageId="&ImageId
End Sub
</script>
</body>

</html>
now on imagepage.asp page, you do the following...

Code:
<%
selectedimageid=request.querystring("ImageId")


set rs=server.createobject("adodb.recordset")
set conn=server.createobject("adodb.connection")


conn.open "your connectionstring here"


sql="SELECT FULLIMAGE FROM  WHERE ImageID="&imageId

rs.open sql, conn

'Now go ahead and display the full image in whatever way you want

%>

post back if you have questions...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top