Modificare il file:
\Galleria\viewimage.asp
<% Response.Buffer = True %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>ASP Folder Gallery</title> <link rel="stylesheet" href="style.css" type="text/css" media="screen" /> <script language="Javascript"> //adapted from http://www.sitepoint.com/article/resize-popup-fit-images-size function ImagePopup(sPicUrl) { window.open( "viewimage.asp?"+sPicUrl, "_self", "resizable=1,scrollbars=1,height=200,width=200,top=20,left=20"); } </script> <script language='javascript'> //adapted from http://www.sitepoint.com/article/resize-popup-fit-images-size var arrTemp=self.location.href.split("?"); var picUrl = (arrTemp.length>0)?arrTemp[1]:""; var NS = (navigator.appName=="Netscape")?true:false; function FitPic() { //using Prev/Next buttons will cause window to grow as image size increases, but window will not scale down if image size decreases. This feels less twitchy as images are scanned. BeginWidth = (NS)?window.innerWidth:document.body.clientWidth; BeginHeight = (NS)?window.innerHeight:document.body.clientHeight; ImgWidth = document.images.target.width; ImgHeight = document.images.target.height; BufferWidth = 30; BufferHeight = 110; ResizeWidth = ImgWidth - BeginWidth + BufferWidth; ResizeHeight = ImgHeight - BeginHeight + BufferHeight; PriorImgWidth = BeginWidth - BufferWidth; PriorImgHeight = BeginHeight - BufferHeight; //dynamically resize to constrain images within current screen resolution //provided by Erik at junk1112@new.rr.com ViewableWidth = screen.width -100; ViewableHeight = screen.height -300; //is height or width difference greater? HeightRatio = ImgHeight / ViewableHeight; WidthRatio = ImgWidth / ViewableWidth; if (WidthRatio > HeightRatio){ if (WidthRatio > 1){ NewImgWidth = ViewableWidth ; target.width=ViewableWidth ; NewImgHeight = ImgHeight / WidthRatio ; target.height=ImgHeight /WidthRatio ; ImgWidth=NewImgWidth;ImgHeight=NewImgHeight; } } else { if (HeightRatio > 1){ NewImgHeight = ViewableHeight ; target.height=ViewableHeight ; NewImgWidth = ImgWidth / HeightRatio ; target.width=ImgWidth /HeightRatio ; ImgWidth=NewImgWidth;ImgHeight=NewImgHeight; } } //end dynamic resizing if (ImgWidth > PriorImgWidth || ImgHeight > PriorImgHeight) { ResizeWidth = ImgWidth - BeginWidth + BufferWidth; ResizeHeight = ImgHeight - BeginHeight + BufferHeight; } else { ResizeWidth = 0; ResizeHeight = 0; } window.resizeBy(ResizeWidth, ResizeHeight); self.focus(); }; </script> </head> <!--#include file="config.txt"--> <% ' retrieve path and file info from Query String Dim strQuery,unstrQuery,arPath,imgParentPath,imageName strQuery = Request.ServerVariables("QUERY_STRING") unstrQuery = unescape(strQuery) arPath = Split(strQuery, "/") imgName = arPath(UBound(arPath,1)) imgParentPath = left(strQuery, len(strQuery)-len(imgName)) 'Gets "next" picture file name 'Previous/Next script adapted from ASP Online Photo Album at http://www.iloire.com/vbscript/online_photo_catalog_vbscript.asp Function FindTheNext (FileName) Dim File,folder,foundFile,theNextFile,fs set fs=Server.CreateObject("Scripting.FileSystemObject") fullPath = Server.MapPath(unstrQuery) strFolder = fs.GetParentFolderName(fullPath) set folder = fs.GetFolder(strFolder) foundFile=0 For each File in folder.Files If instr(1,AllowExt,fs.GetExtensionName(File.path),1)>0 then If foundFile=1 Then FindTheNext = File.Name foundFile=0 Exit Function Else If File.Name=fs.GetFileName(FileName) Then foundFile=1 End If End If End If Next FindTheNext="" set fs=nothing End Function 'Gets "previous" picture file name Function FindThePrev (FileName) Dim File,foundFile,theNextFile,folder,fs, fullPath, strFolder, imgFolder set fs=Server.CreateObject("Scripting.FileSystemObject") fullPath = Server.MapPath(unstrQuery) strFolder = fs.GetParentFolderName(fullPath) set folder = fs.GetFolder(strFolder) theNextFile="" For each File in folder.Files If instr(1,AllowExt,fs.GetExtensionName(File.path),1)>0 then If File.Name=fs.GetFileName(FileName) Then FindThePrev=theNextFile Exit Function Else theNextFile=File.Name End If End If Next FindThePrev="" set fs=nothing End Function %> <body bgcolor="#000000" onload='FitPic();' topmargin="0" marginheight="0" leftmargin="0" marginwidth="0"> <br> <table align="center"> <tr> <td width="33%"><div align="center"> <%thePrev = FindThePrev(strQuery) If len(thePrev) Then Response.Write "<a href=javascript:ImagePopup('" & Server.URLEncode(imgParentPath & thePrev) & "')" & ">" & " <img border=""0"" alt=""Immagine precedente"" src=""graphics/leftarrow.gif"" /></a>"%></div> </td> <td width="15%"> <div id="selectButton" align="right"><a href="download_script.asp?file=<%= strQuery %>">Salva Immag.</a></div> </td> <td width="15%"> <div id="selectButton" align="left"><a href="javascript:window.close()">Chiudi finestra</a></div> </td> <td width="35%"><div align="center"> <%theNext=FindTheNext(strQuery) If len(theNext) Then Response.Write "<a href=javascript:ImagePopup('" & Server.URLEncode(imgParentPath & theNext) & "')" & ">" & " <img border=""0"" alt=""Immagine successiva"" src=""graphics/rightarrow.gif"" /></a>"%></div> </td> </tr> <tr> <td colspan="4"> <div align="center"> <span class="smText" style="color:yellow; font-weight:bold;">[ <%=imgName%> ] </span> </div> </td> </tr> </table> <div align="center"><font face="verdana, arial" size="1" color="white"> </font> </div> <br> <div align="center"> <table border="0" cellspacing="0"> <tr> <td width="100%" valign="top" align="center"> <script language='javascript'> document.write( "<img src='" + picUrl + "' border=0 name=target>" ); </script> </td> </tr> </table> </div> </body> </html>
[
Íàçàä
]