I have this page that dispays images from a directory.
I have them showing in one long column. i would like to get it to show
up thumnailed in rows and columns. if you want to hard code it ideall
i would like it 4 columns. simpley great that local directory
structure and drop some images in the directory to test it out.
<%Option Explicit%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Images</title>
<base target="_self">
</head>
<body>
<%
'Global Vars
Dim Newline
Dim Tabstop
Dim FSO
Dim RelativeIISPath
RelativeIISPath = "/site/Logs/general/img"
Const FolderName = "D:/inetpub/wwwroot/site/carpenoctem/Logs/general/img"
'Functions
Function DisplayFileNames(Foldername)
Dim S
Dim Files
Dim File
Dim Filename
Dim ImageFilename
Dim Folder
Dim Str
Dim strExt
Dim Num
Dim Num1
Dim Nat
Dim bc
Set bc = Server.CreateObject("MSWC.BrowserType")
If bc.browser <> "IE" Then RelativeIISPath = "/site/Logs/general/img"
' Response.Write " Browser in use > " & bc.browser &
Newline ' Diagnostic
If FSO.FolderExists(foldername) Then
Set Folder = FSO.GetFolder(Foldername)
S = ""
Set Files = Folder.Files
If Files.Count <> 0 Then
For Each File In Files ' Construct FileName for Thumnail & Hot link
' Asumes if there is a
".jpg" or ".gif" there is an HTML listing
strExt = ""
If Right ( File.Name , 3 ) = "gif" Then strExt = ".gif"
If Right ( File.Name , 3 ) = "jpg" Then strExt = ".jpg"
If Right ( File.Name , 3 ) = "GIF" Then strExt = ".gif"
If Right ( File.Name , 3 ) = "JPG" Then strExt = ".jpg"
If strExt <> "" Then
' found a Picture file of ".gif" or ".jpg"
Num = Len(File.Name)
Filename = ""
Nat = 0
Num1 = 1
Do While Num1 <= Num
Str = Left (File.Name , Num1)
If Right ( Str,1 ) = "@" Then Nat = Num1
If Right ( Str,1 ) <> " " Then
Filename = Filename & Right ( Str,1 )
Else
Filename = Filename & "%" & "2" & "0"
End If
Num1 = Num1 + 1
Loop
' Construct Hot Link text from FileName
Num = Num - Nat
Str = Right ( File.Name , Num) ' strip off chars thru "@"
Num = Num - 4
Str = Left (str , Num) ' Strip off 4 char file extension ".txt" or .htm
' Construct Image filename for Thumnail from FileName
Num = Len ( Filename )
Num = Num - 4
ImageFilename = Left ( Filename , Num ) '
Strip off File Extension ".xxx"
Filename = ImageFilename & ".htm" ' create filename for link to HTML page
ImageFilename = ImageFilename & strExt ' create filename for picture
s = s & "<a href=" & RelativeIISPath & "/" &
Filename & "><img border=""0"" src=" & RelativeIISPath & "/" &
ImageFilename & " width=""123"" height=""89""
align=""center""></a> <a href=" & RelativeIISPath & "/" &
Filename & "><font SIZE=""2"">" & Str & "</a><p> </p>"
End If
Next
ELSE
S = "<p> </p> <p ALIGN=""center"">No Pictures Posted yet!</p>"
End If
Else
S = "<p> </p> <p ALIGN=""center"">No Pictures Posted yet!</p>"
End If
DisplayFileNames = S
End Function
'Procedures
Sub Main
TabStop = Chr(9)
NewLine = Chr(10)
Set FSO = CreateObject("Scripting.FileSystemObject")
Response.Write "<PRE> <body bgcolor=""#FFFFFF"" text=""#000000""
link=""#800080"" vlink=""#008080"" alink=""#C0C0C0"" style=""float:
left"" topmargin=""0"" leftmargin=""0""><div
align=""left""><center><table border=""0"" width=""517""
height=""110"" bordercolor=""#FFFFFF"" cellspacing=""0""
cellpadding=""0"" align=""left""><tr><td width=""780"" height=""90""
bgcolor=""#000000""><p align=""center""><font face=""Americana BT""
size=""6"" color=""#FFFFFF"">Carpe Noctem Photo
Gallery</font></td></tr></center><tr><td width=""780"" height=""473""
valign=""top"" bgcolor=""#FFFFFF"" bordercolor=""#FFFFFF""><p
align=""left""><font SIZE=""+2""><b>"
Response.Write DisplayFileNames(FolderName)
Response.Write "</td></tr></table></div></b></font></p></PRE>"
End Sub
'Main Call
Main
%>
</body>
</html> |