|
Subject:
|
Images in directory
|
|
Posted By:
|
ldoodle
|
Post Date:
|
2/8/2006 11:42:06 AM
|
Hi there,
I need to display all the images in a directory, inside a table no more that 4 columns wide (but I would like it to be easily customizable if I need to change it). It can be any number of rows, obviously depending on how many images there are.
The images will be stored in a different folder to the .asp page.
Thanks very much/...
|
|
Reply By:
|
Dj Kat
|
Reply Date:
|
2/15/2006 3:36:51 AM
|
Hi,
try this script and ajust it to you liking
<%
Dim fso, sRoot
Set fso = Server.CreateObject("Scripting.FileSystemObject")
'put your folder here
sRoot = "c:\Temp'Server.MapPath("/")
buildTree(sRoot)
'Functie die de lengte van het bestand zonder extensie ophaalt
Function LenghtFileMinusExtension(fileName)
LenghtFile=Len(fileName)
LenghtFileMinusExtension=LenghtFile -1- len(fso.GetExtensionName(fileName))
End Function
Function buildTree(path)
Dim dl, d, fl, f,fileToString,fileOnly
Set dl = fso.GetFolder(path).SubFolders
For Each d In dl
'Response.Write d.Name & "<br />"
Set fl = fso.GetFolder(d.path).Files
For Each f In fl
'Remove Thumbs.db
If fso.GetExtensionName(f.Name)<>"db" Then
fileToString=Replace(f.path, sRoot, "")
fileOnly=f.Name
'Filename
Response.Write(left(fileOnly,LenghtFileMinusExtension(fileOnly))&"<br />")
'Filename and path
'Response.Write left(fileToString,LenghtFileMinusExtension(fileToString)) & "<br />"
End If
Next
Set fl = Nothing
buildTree(d.Path)
Next
Set dl = Nothing
Response.Write "</ul>"
End Function
Set fso = Nothing
'Response.Write
%>
__________________________________________________________ This is my junk I'm gona eat it
|