Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamic Columns for Images

0 views
Skip to first unread message

Chris Guimbellot

unread,
Jul 5, 2002, 2:32:58 PM7/5/02
to
Hello,

I have a page with code to find images in a folder meeting certain
criteria and displaying them (THANKS JIM). Here's the code:

==========================================
<%@LANGUAGE="VBSCRIPT"%>
<%
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Dim objFolder
Set objFolder = objFSO.GetFolder(Server.Mappath("images/propimages/thumb"))

%>
<HTML>
<HEAD>
<TITLE>View Directory</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
</HEAD>
<BODY bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080"
alink="#FF0000">
<TABLE width="100%" cellpadding="2">
<TR>
<TD align="center" height="45"><FONT color="#3333FF"><B>Dynamic list of
files:
<%= objFolder.Name %><BR>
&nbsp; </B></FONT></TD>
</TR>
<TR>
<TD> </TD>
</TR>
<TR>
<TD> <B>
<%
Dim objFile
For Each objFile in objFolder.Files
ShortName = Left(objFile.Name,5)
If ShortName = "DARHS" Then
Response.Write "<img src='images/propimages/thumb/"&objFile.Name&"'>"&
objFile.Name "</> (" & objFile.Size & " bytes)<BR>"
End If
Next

Set objFolder = Nothing
Set objFile = Nothing
Set objFSO = Nothing
%>
</B></TD>
</TR>
</TABLE>
</BODY>
</HTML>
=================================================
What I would like to do now, is have the images display in rows and columns.
Since the number of images meeting the criterion is not initially known, the
page has to create the table structure on the fly. Thats what I assume
anyway. Is there anyone who knows how to make this happen? Thanks,

Chris


Tony V

unread,
Jul 5, 2002, 2:42:09 PM7/5/02
to
something like this:
(NOTE: Notice the changed response.write string that has the <td></td> in
it...)

<table border="0">
<%
dim colcount, maxcol

colcount=1
maxcol=3
// maximum columns = 3, we start at column 1

For Each objFile in objFolder.Files
ShortName = Left(objFile.Name,5)
If ShortName = "DARHS" Then

if colcount=1 then
response.write "<tr>"
end if

Response.Write "<td><img
src='images/propimages/thumb/"&objFile.Name&"'>"&
objFile.Name "</> (" & objFile.Size & " bytes)</td>"

colcount=colcount+1
if colcount=maxcol then
colcount=1
response.write "</tr>"
end if

End If
Next
%>


Chris Guimbellot

unread,
Jul 5, 2002, 3:02:57 PM7/5/02
to
Tony,

That worked like a champ. I appreciate the help.

Chris

"Tony V" <nospam...@mod-soft.com> wrote in message
news:#QXlPOFJCHA.2984@tkmsftngp13...

0 new messages