I want to dynamically create a table to display thumbnail images. The table should only have four columns, but can have as many rows as needed to display all the images. I am pulling the images from my web server using the FileSystemObject object and I am inserting the file name into the image tag.
My challenge is how to only limit the table to four columns while still looping through all the image files in the folder. Here is my code:
****************
<table width="100%" cellspacing="0" cellpadding="0" border="1">
<%
dim objFSO, strPath, objFiles, objFolder
strPath = "c:\inetpub\set objFSO = Server.CreateObject("Scripting.FileSystemObject"
if objFSO.FolderExists(strPath) then
'Response.Write "yes"
set objFolder = objFSO.GetFolder(strPath)
Response.Write "<tr>"
for each objFiles in objFolder.files
if LCase(Right(objFiles.name,4)) = ".gif" then
Response.Write "<td> <img src='" & objFiles.name & "'>" & i & "</td>"
end if
next
Response.Write "</tr>"
else
Response.Write "no"
end if
%>
</table>
*************************************
Any ideas or am I attempting something that is not worth the effort? I'm attempting this mainly so that I can write a subroutine for later use so I won't have to manually code the images in my web page.
Thanks
My challenge is how to only limit the table to four columns while still looping through all the image files in the folder. Here is my code:
****************
<table width="100%" cellspacing="0" cellpadding="0" border="1">
<%
dim objFSO, strPath, objFiles, objFolder
strPath = "c:\inetpub\set objFSO = Server.CreateObject("Scripting.FileSystemObject"
if objFSO.FolderExists(strPath) then
'Response.Write "yes"
set objFolder = objFSO.GetFolder(strPath)
Response.Write "<tr>"
for each objFiles in objFolder.files
if LCase(Right(objFiles.name,4)) = ".gif" then
Response.Write "<td> <img src='" & objFiles.name & "'>" & i & "</td>"
end if
next
Response.Write "</tr>"
else
Response.Write "no"
end if
%>
</table>
*************************************
Any ideas or am I attempting something that is not worth the effort? I'm attempting this mainly so that I can write a subroutine for later use so I won't have to manually code the images in my web page.
Thanks