Forum Moderators: open
How do I get thumbnails extracted from a database to appear in individual cells. Here is an example of what it needs to look like. <snip>
I don't want to have to manually enter the html into the page whenever I add a picture into the database.
Thanks,
Brandon
[edited by: Xoc at 9:53 am (utc) on Sep. 21, 2003]
[edit reason] snipped urls [/edit]
I need a table with 42 cells, 6 cols and 7 rows.
-------------------------------
¦ ¦ ¦ ¦ ¦ ¦ ¦
¦ 1 ¦ 2 ¦ 3 ¦ 4 ¦ 5 ¦etc.¦
-------------------------------
¦ ¦ ¦ ¦ ¦ ¦ ¦
¦ 7 ¦ ...¦ ¦ ¦ ¦ ¦
-------------------------------
¦ ¦ ¦ ¦ ¦ ¦ ¦
¦ ¦ ¦ ¦ ¦ ¦ ¦
-------------------------------
¦ ¦ ¦ ¦ ¦ ¦ ¦
¦ ¦ ¦ ¦ ¦ ¦ ¦
-------------------------------
¦ ¦ ¦ ¦ ¦ ¦ ¦
¦ ¦ ¦ ¦ ¦ ¦ ¦
-------------------------------
¦ ¦ ¦ ¦ ¦ ¦ ¦
¦ ¦ ¦ ¦ ¦ ¦ ¦
-------------------------------
¦ ¦ ¦ ¦ ¦ ¦ ¦
¦ ¦ ¦ ¦ ¦ ¦ ¦
-------------------------------
How should I write the script to make it appear this way?
Thanks,
Brandon
Another way:
Response.write "<table>"
colCount=6 ' set number of columns
cols = 0
While not rs.eof
Path=rs("Path")
if cols=0 then
Response.write "<tr><td><img src=/gallery/" & Path & "></td>"
elseif cols mod colCount =0 then
Response.write "</tr><tr><td><img src=/gallery/" & Path & "></td>"
else
Response.write "<td><img src=/gallery/" & Path & "></td>"
end if
cols=cols+1
rs.MoveNext
wend
Response.write "</table>"
<html>
<body>
<table border="0" width="400" cellspacing="0" cellpadding="0">
<%
set fso = server.createobject("Scripting.FileSystemObject")
set MyFolder = fso.GetFolder(Server.MapPath("thumbnails"))
Dim Thumbnail()
for each file in MyFolder.files
ImageCount = ImageCount + 1
next
response.write "ImageCount: " & ImageCount & "<br>"
ReDim Thumbnail(ImageCount)
count=0
for each file in MyFolder.files
Count=Count+1
Thumbnail(Count) = file.name
'response.write Thumbnail(Count) & "<br>"
next
for n = 1 to ImageCount
%>
<tr>
<td width="100" height="100"><%if n <= ImageCount then%><img src="thumbnails/<%=Thumbnail(n)%>"><%n=n+1%><%end if%></td>
<td width="100" height="100"><%if n <= ImageCount then%><img src="thumbnails/<%=Thumbnail(n)%>"><%n=n+1%><%end if%></td>
<td width="100" height="100"><%if n <= ImageCount then%><img src="thumbnails/<%=Thumbnail(n)%>"><%n=n+1%><%end if%></td>
<td width="100" height="100"><%if n <= ImageCount then%><img src="thumbnails/<%=Thumbnail(n)%>"><%n=n%><%end if%></td>
</tr>
<%
next
%>
</table>
</body>
</html>