<% Response.Buffer = False %> <% DIM StartTime StartTime = Timer %> <% 'Set cookie for Browser Preference BrowseChoice = Request.Cookies("BrowseChoice") If BrowseChoice <> "" Then BrowseChoice = BrowseChoice Else BrowseChoice = "Thumbnails" End If%> <% 'Folder to navigate sDirectory = ImgDirectory 'Begin Script Dim sError On Error Resume Next sDirectory = trim(sDirectory) If right(sDirectory,1) <> "/" Then sDirectory = sDirectory & "/" 'Get subfolder from passed querystring sDir = sDirectory & Request.querystring("dir") sDir = trim(sDir) If right(sDir,1) <> "/" Then sDir = sDir & "/" 'Important! Make sure the subfolder path is in the shared folder. This keeps ' users from browsing directories outside of the shared. ie: dir=../ ' Code below puts user back into the default directory. sFolder = Server.MapPath( sDir ) sDirFolder = Server.MapPath( sDirectory ) sSubFolder = right(sDir,len(sDir)-len(sDirectory)) If instr( sFolder , sDirFolder ) = 0 Then sFolder = sDirFolder sSubFolder = "" sError = sError & " Path not authorized;" End If 'Load the file system and navigate to shared folder. Set objFileObject = Server.CreateObject("Scripting.FileSystemObject") Set objFolder = objFileObject.GetFolder( sFolder ) 'Handle missing or misspelled folder path. If IsEmpty( objFolder ) Then sFolder = sDirFolder sSubFolder = "" sDir = sDirectory Set objFolder = objFileObject.GetFolder( sFolder ) sError = sError & " Cartella non trovata;" End If 'Read text files for caption, copyrights Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 DescriptionFilename = sDir & CommentFile Dim DescriptionFilepath DescriptionFilepath = Server.MapPath(DescriptionFilename) If objFileObject.FileExists(DescriptionFilepath) Then Set TextStream = objFileObject.OpenTextFile(DescriptionFilepath, ForReading, False, TristateUseDefault) Dim DescriptionContents DescriptionContents = TextStream.ReadAll TextStream.Close Set TextStream = nothing DescriptionContents = Replace(DescriptionContents , vbCrLf, "") DescriptionContents = "

" & DescriptionContents & "

" End If %>
[Ricerca Immagini]

<% 'Build path navigation aNames = Split( sSubFolder , "/") If bShowPath Then If UBound( aNames ) > 0 Or bShowRoot Then %> <% End If For count = 0 to UBound( aNames ) -2 aDirUp = aDirUp & aNames(count) & "/" Next %> <% 'Iterate through subfolders in shared folder For Each objFile In objFolder.SubFolders If instr( objFile.name , "vti_cnf" ) = 0 Then 'Alternate row colors If iAlternate = 0 Then response.write "" iAlternate = 1 Else response.write "" iAlternate = 0 End If %> <% 'Next Folder End If Next 'Iterate through files in shared folder / subfolder. FileSize used to validate presence of image. Dim FileSize FileSize = 0 For Each objFile In objFolder.Files sFileName = objFile.name 'Only continue if it's a valid extension If ( IsValidFile (sFileName) ) Then 'Alternate row colors. If iAlternate = 0 Then response.write "" iAlternate = 1 FileSize = FileSize + objFile.Size Else response.write "" iAlternate = 0 End If %> <% 'Set browse choice - thumb or file name Set ServerName=Request.ServerVariables("SERVER_NAME") If BrowseChoice = "Thumbnails" Then ImgChoice = "" & sFileName & "" Else ImgChoice = sFileName End If 'End If %> <%'Get image properties using imgprop include Set objFSO = CreateObject("Scripting.FileSystemObject") Set objF = objFSO.GetFile(Server.MapPath(sDir) & "\" & sFileName) if gfxSpex(objF, w, h, c, strType) = true then response.write "" else response.write "" end if Set objFSO = nothing Set objF = nothing %> <% End If Next 'Clean up memory leaks Set objFileObject = nothing Set objFolder = nothing 'Iterate through and approve extensions Function IsValidFile(FileName) If Not AllowExt <> "" or LCase( AllowExt ) = "all" Then IsValidFile = True Else aAllowExt = Split( AllowExt & "," , ",") IsValidFile = False For iCnt = 0 to UBound( aAllowExt ) -1 If right( FileName , len( FileName ) - InStrRev( FileName , "." ) ) = Trim(aAllowExt( iCnt )) Then IsValidFile = True Next End If If DenyExt <> "" Then aDenyExt = Split( DenyExt & "," , ",") For iCnt = 0 to UBound( aDenyExt ) -1 If right( FileName , len( FileName ) - InStrRev( FileName , "." ) ) = Trim(aDenyExt( iCnt )) Then IsValidFile = False Next End If End Function 'Display friendly byte size Function ByteConversion(NumberOfBytes) If NumberOfBytes < 1024 Then sDisplayBytes = NumberOfBytes & " bytes" End If If NumberOfBytes >= 1024 Then sDisplayBytes = FormatNumber( NumberOfBytes / 1024, 1) & " KB" End If If NumberOfBytes > 1048576 Then sDisplayBytes = FormatNumber( NumberOfBytes / 1048576, 1) & " MB" End If Response.Write sDisplayBytes End Function 'Display friendly color depth Function DepthConversion(CDepth) If CDepth >=2 Then sDisplayDepth = CDepth & " colors" End If If CDepth >=4 Then sDisplayDepth = CDepth & " colors" End If If CDepth >=8 Then sDisplayDepth = CDepth & " colors" End If If CDepth >=16 Then sDisplayDepth = CDepth & " colors" End If If CDepth >=32 Then sDisplayDepth = CDepth & " colors" End If If CDepth >=64 Then sDisplayDepth = CDepth & " colors" End If If CDepth >=128 Then sDisplayDepth = CDepth & " colors" End If If CDepth >=256 Then sDisplayDepth = CDepth & " colors" End If If CDepth >=65535 Then sDisplayDepth = FormatNumber (CDepth / 1000, 1) &"K" & " colors" End If If CDepth >=16777215 Then sDisplayDepth = FormatNumber (CDepth / 1000000, 1) &"M" & " colors" End If Response.Write sDisplayDepth End Function 'Handle errors If Err <> 0 or sError <> "" Then response.write "" End If %> <%If DescriptionContents <> "" Then%> <%End If%> <%If FileSize > 0 Then If infoBox = true then%> <%End If End If %>

  "><%= Left(sDirectory,len(sDirectory)-1) %> <% End If For count = 0 to UBound( aNames ) -1 If instr( aNames(count),"vti_cnf" ) = 0 Then aURL = aURL & aNames(count) & "/" %>  <%= sChevron %> ?dir=<%= Server.URLEncode( aURL ) %>"><%= aNames(count) %> <% End If Next %>  

?dir=<%= Server.URLEncode( aDirUp ) %>">Back One Level

Cartella/File

Grandezza/Info

Azione

?dir=<%= Server.URLEncode( sSubFolder & objFile.Name )%>">Open Folder

?dir=<%= Server.URLEncode( sSubFolder & objFile.Name )%>"><%= objFile.Name %>

<%= ByteConversion( objFile.Size ) %>

<%If objFile.Type = "File Folder" then response.write "" else response.write "N/A" end if%>

 

<%=ImgChoice%>

<% If BrowseChoice = "Thumbnails" Then Response.Write "

   [" & sFileName & "]

" End If %>
" response.write strType response.write "
" response.write ByteConversion(objF.Size) response.write "
" response.write w & " x " & h response.write "
" response.write DepthConversion(c) response.write "
N/A

ERROR: " & sError & space(1) & "ASP: " & Err.description & ";
Info Box <%=DescriptionContents%>
Info Box


Clicca sulla miniatura per aprire l'immagine a grandezza naturale.

<% Dim EndTime EndTime = Timer Dim TimeDelta TimeDelta = FormatNumber(EndTime - StartTime, 4) Response.Write "

Tempo di creazione della pagina: [" & TimeDelta & " secondi]" %>