Modificare il file:
\Galleria\browse_code.asp
<head> <style> <!-- .result {padding : 2px 4px 0 4px;} .BAB_CPBodyStyleLocal { padding : 0; margin-left: 2pt; margin-right: 2pt; } .full-text-translation { padding : 4px; margin: 0 -2pt; } --> </style> </head> <% Response.Buffer = False %> <% DIM StartTime StartTime = Timer %> <script language="Javascript"> //adapted from http://www.sitepoint.com/article/resize-popup-fit-images-size function ImagePopup(sPicUrl) { window.open( "viewimage.asp?"+sPicUrl, "", "resizable=1,scrollbars=1,height=200,width=200,top=20,left=20"); } </script> <script language="JavaScript" type="text/javascript"> var win = null; function NewWindow(mypage,myname,w,h,scroll){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' win = window.open(mypage,myname,settings); win.focus(); } </script> <% 'Set cookie for Browser Preference BrowseChoice = Request.Cookies("BrowseChoice") If BrowseChoice <> "" Then BrowseChoice = BrowseChoice Else BrowseChoice = "Thumbnails" End If%> <!--used to determine image properties--> <!--http://www.4guysfromrolla.com/webtech/050300-1.shtml--> <!--#include file="imgprop.asp"--> <!--#include file="config.txt"--> <% '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 = "<p>" & DescriptionContents & "</p>" End If %> <div align="center"> <a class="smText" href="search.asp">[Ricerca Immagini]</a><br><br> </div> <table align="center" class="border2" cellspacing="2" width="" cellpadding="2"> <% 'Build path navigation aNames = Split( sSubFolder , "/") If bShowPath Then If UBound( aNames ) > 0 Or bShowRoot Then %> <tr> <td colspan="4" align="left"><p> <b> <a class="browse" href="<%= Request.ServerVariables("SCRIPT_NAME") %>"><%= Left(sDirectory,len(sDirectory)-1) %></a></b> <% End If For count = 0 to UBound( aNames ) -1 If instr( aNames(count),"vti_cnf" ) = 0 Then aURL = aURL & aNames(count) & "/" %> <%= sChevron %> <b><a class="browse" href="<%= Request.ServerVariables("SCRIPT_NAME") %>?dir=<%= Server.URLEncode( aURL ) %>"><%= aNames(count) %></a></b> <% End If Next %> </td></tr> <% End If For count = 0 to UBound( aNames ) -2 aDirUp = aDirUp & aNames(count) & "/" Next %> <!-- Build column titles --> <tr> <td align="center" class="border2" style="padding:2px"><a href="<%= Request.ServerVariables("SCRIPT_NAME") %>?dir=<%= Server.URLEncode( aDirUp ) %>"><img src="graphics/uparrow.gif" border="0" width="20" height="20" alt="Back One Level"></a></td> <td align="left" class="border2 hpadding"><h2>Cartella/File</h2></td> <td align="center" class="border2 hpadding"><h2>Grandezza/Info</h2></td> <td align="center" class="border2 hpadding"><h2>Azione</h2></td> </tr> <% '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 "<tr class='folderrow1'>" iAlternate = 1 Else response.write "<tr class='folderrow2'>" iAlternate = 0 End If %> <!-- Display folder with link to navigate --> <td align="center"><a href="<%= Request.ServerVariables("SCRIPT_NAME") %>?dir=<%= Server.URLEncode( sSubFolder & objFile.Name )%>"><img src="graphics/folder.gif" border="0" width="17" height="17" alt="Open Folder"></a></td> <td><p style="text-align:left; margin-left:5px"><a class="browse" href="<%= Request.ServerVariables("SCRIPT_NAME") %>?dir=<%= Server.URLEncode( sSubFolder & objFile.Name )%>"><%= objFile.Name %></a></td> <td><p style="text-align:right; margin-right:15px"><%= ByteConversion( objFile.Size ) %></p></td> <td align="center"><p> <%If objFile.Type = "File Folder" then response.write "" else response.write "N/A" end if%></p></td> </tr> <% '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 "<tr class='filerow1'>" iAlternate = 1 FileSize = FileSize + objFile.Size Else response.write "<tr class='filerow2'>" iAlternate = 0 End If %> <% 'Set browse choice - thumb or file name Set ServerName=Request.ServerVariables("SERVER_NAME") If BrowseChoice = "Thumbnails" Then ImgChoice = "<img border='0' alt='" & sFileName & "' src='thumbnail.aspx?FileName=" & Server.MapPath(sDir) & "\" & sFileName & "&width=175'>" Else ImgChoice = sFileName End If 'End If %> <!-- Display folder contents with view and download links --> <td class="borderBot"> </td> <td align="left" class="borderBot"><br><p><a href="javascript:ImagePopup('<%=escape(sDir)%><%=escape(sFileName)%>')"><%=ImgChoice%><br></p></a> <% If BrowseChoice = "Thumbnails" Then Response.Write "<div align='left'><p class='smOrngText'> [" & sFileName & "]<br><br></div>" End If %></td> <%'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 "<td align='center' class='borderBot'><div class='smText'>" response.write strType response.write "<br>" response.write ByteConversion(objF.Size) response.write "<br>" response.write w & " x " & h response.write "<br>" response.write DepthConversion(c) response.write "</div></td>" else response.write "<td align='center' class='borderBot'><div class='smText'> N/A </div></td>" end if Set objFSO = nothing Set objF = nothing %> <td align="center" class="borderBot"> <div id="selectButton" align="center"><a href="javascript:ImagePopup('<%=escape(sDir)%><%=escape(sFileName)%>')">Visualizza</a></div><br> <div id="selectButton" align="center"> <a href="download_script.asp?file=<%= escape(sDir) %><%= escape(sFileName)%>"> Scarica</a></div> </td> </tr> <% 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 "<tr><td bgcolor=""#000000"" colspan=""5""><font face=""Verdana, Arial, Helvetica"" color=""red"" size=""1"">ERROR: " & sError & space(1) & "ASP: " & Err.description & ";</font></td></tr>" End If %> <!-- Display nfo.htm file if present--> <%If DescriptionContents <> "" Then%> <tr> <td align="center" class="border1"><img src="graphics/info.gif" border="0" width="16" height="16" alt="Info Box"></td> <td class="border1" align="left" style="padding-left: 10px; padding-right: 4px" colspan="3"> <%=DescriptionContents%><br /> </td> </tr> <%End If%> <!-- Display info box if thumbnails present (and infoBox toggled True). Presence of thumbnail(s) determined using FileSize variable. The presence of at least one file with valid image extension will trigger FileSize greater than 0. Cannot use IsValidFile function for this purpose because caption files are considered invalid. As a result if a folder contains both images and caption file the thumbnail message will not display. --> <%If FileSize > 0 Then If infoBox = true then%> <tr> <td align="center" class="border1"><img src="graphics/info.gif" border="0" width="16" height="16" alt="Info Box"></td> <td class="border1" style="padding-left: 10px; padding-right: 4px" colspan="3"> <p align="left" class="smOrngText"><br /><span id="BABID_Results">Clicca sulla miniatura per aprire l'immagine a grandezza naturale.</span><br> </td> </tr> <%End If End If %> </td> </tr> </table> <% Dim EndTime EndTime = Timer Dim TimeDelta TimeDelta = FormatNumber(EndTime - StartTime, 4) Response.Write "<br><br><p class='smOrngText' style='text-align:center;'><i>Tempo di creazione della pagina: [" & TimeDelta & " secondi]</i>" %>
[
Íàçàä
]