Con questo codice scansione le varie directori fino ad arrivare alle foto che prima vengono visualizzate in provini(link) e poi con una singolarmente ........il mio problema è che nn riesco a formattare cioè disporre in colonne i provini cosa che adesso nn fa perche me le incolonna verticalmente una sotto l'altra questo è il codice
<%
Dim ValidExt(4)
ValidExt(0) = "jpg"
ValidExt(1) = "gif"
ValidExt(2) = "png"
ValidExt(3) = "bmp"
imgpath = "/Cairo/images/"
path2= "\Cairo"
Function STVGallery(path)
On Error Resume Next
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
root = Server.Mappath("/Cairo/foto/")
url = Request.ServerVariables("/Cairo/foto/")
webpath = left(url, instrrev(url, "/"))
If path = "" or right(path, 1) = "/" or right(path, 1) = "\" then
If instr(path, "/") > 0 then
path = replace(path, "/", "\")
End if
If left(path, 1) <> "\" then
path = "\" & path
End if
If right(path, 1) <> "\" then
path = path & "\"
End if
If instr(path, "..") < 1 then
uppath = left(replace(path, "\", "/"), instrrev(left(replace(path, "\", "/"), len(path)-1), "/"))
If uppath = "" then
uppath = "/"
End if
result = vbcrlf & "" & vbcrlf
result = result & "<table border=""0"" cellspacing=""3"" cellpadding=""0"">" & vbcrlf
result = result & " <tr>" & vbcrlf
result = result & " <td width=""18"" align=""center"">[img][/img]</td>" & vbcrlf
result = result & " <td nowrap></td>" & vbcrlf
result = result & " </tr>" & vbcrlf
result = result & " <tr>" & vbcrlf
result = result & " <td colspan=""2"" style=""height: 10px""></td>" & vbcrlf
result = result & " </tr>" & vbcrlf
If FSO.FolderExists(root & path) then
Set dir = FSO.GetFolder(root & path)
Set subdirs = dir.SubFolders
For each subdir in subdirs
If err.Number = 0 then
result = result & " <tr>" & vbcrlf
result = result & " <td align=""center""></td>" & vbcrlf & " <td nowrap>" & subdir.name & "</td>" & vbcrlf
result = result & " </tr>" & vbcrlf
Else
result = result & " <tr>" & vbcrlf
result = result & " <td></td><td>" & err.Description & "</td>" & vbcrlf
result = result & " </tr>" & vbcrlf
err.Clear
End if
Next
Set subdirs = Nothing
Set dirfiles =dir.Files
result = result & "
" & vbcrlf
For each dirfile in dirfiles
cont=cont+1
For ext = 0 to ubound(ValidExt)-1
If instr(right(lcase(dirfile), 4), ValidExt(ext)) > 0 then
If cont<6Then
result = result & " </tr>" & vbcrlf
result = result & "
" & vbcrlf
result = result & "
" & vbcrlf
End if
result = result & "<align=""left"">[img][/img]</td>"& vbcrlf
'result = result & " " & vbcrlf'
End if
'result = result & " </td>" & vbcrlf'
Next
Next
Set dirfiles = Nothing
Set dir = Nothing
Else
result = result & " <tr>" & vbcrlf
result = result & " <td></td>" & vbcrlf
result = result & " <td nowrap>Path not found</td>" & vbcrlf
result = result & " </tr>" & vbcrlf
End if
result = result & "</table>" & vbcrlf
result = result & "" & vbcrlf
Else
Response.Redirect(webpath)
End if
Else
If instr(path, "/") > 0 then
path = replace(path, "/", "\")
End if
If left(path, 1) <> "\" then
path = "\" & path
End if
If instr(path, "..") < 1 then
uppath = left(replace(path, "\", "/"), instrrev(left(replace(path, "\", "/"), len(path)-1), "/"))
result = vbcrlf & "" & vbcrlf
result = result & "<table border=""0"" cellspacing=""3"" cellpadding=""0"">" & vbcrlf
result = result & " <tr>" & vbcrlf
result = result & " <td width=""80"" height=""50"" nowrap align=""center"">[img][/img]</td>" & vbcrlf
result = result & " <td nowrap></td>" & vbcrlf
result = result & "
" & vbcrlf
result = result & " </tr>" & vbcrlf
result = result & "</table>" & vbcrlf
If uppath = "" then
uppath = "/"
End if
If FSO.FileExists(root & path) then
Set imgfile = FSO.GetFile(root & path)
imgname = imgfile.Name
result = result & "<p align=""center"">[img][/img]</p>" & vbcrlf
'result= result &"<p align=""center"">"& imgname&"</p>"& vbcrlf'
Set imgfile = Nothing
dirpath = left(path, len(path)-len(imgname))
Set dir = FSO.GetFolder(root & dirpath)
Set dirfiles = dir.Files
counter = 0
For each dirfile in dirfiles
For ext = 0 to ubound(ValidExt)-1
If instr(right(lcase(dirfile), 4), ValidExt(ext)) > 0 then
counter = counter + 1
If instr(dirfile, imgname) > 0 then
imgfileloc = counter
End if
End if
Next
Next
counter = 0
For each dirfile in dirfiles
For ext = 0 to ubound(ValidExt)-1
If instr(right(lcase(dirfile), 4), ValidExt(ext)) > 0 then
counter = counter + 1
If counter = imgfileloc-1 then
prevfile = dirfile.name
prevfileloc = counter
End if
If counter = imgfileloc+1 then
nextfile = dirfile.name
nextfileloc = counter
End if
End if
Next
Next
Set dirfiles = Nothing
Set dir = Nothing
result = result & "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbcrlf
result = result & " <tr>" & vbcrlf
result = result & " <td width=""50%"" nowrap>"
If prevfile <> "" then
result = result & "<nowrap align=""center"">[img][/img]"
End if
result = result & "</td>" & vbcrlf
result = result & " <td width=""30%"" align=""right"">"
If nextfile <> "" then
result = result & "[img][/img]"
End if
result = result & "</td>" & vbcrlf
result = result & " </tr>" & vbcrlf
result = result & "</table>" & vbcrlf
result = result & "" & vbcrlf
Else
If err.Number = 0 then
result = result & "
File not found"
Else
result = result & "
" & err.Description
err.Clear
End if
End if
Else
Response.Redirect(webpath)
End if
End if
Set FSO = Nothing
STVGallery = result
End function
%>
grazie!

Rispondi quotando
