<% '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 'Credits: 'Original script created by Indecka. ' 'Please feel free to adapt and improve these scripts, 'but you must leave the above. '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 'OBJECTS '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Set Jpeg = Server.CreateObject("Persits.Jpeg") Set fso = CreateObject("Scripting.FileSystemObject") '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 'GLOBAL CONSTANTS '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ inGallery_VersionNumber = "1.2d" inGallery_pageMain = Request.ServerVariables("SCRIPT_NAME") inGallery_dirOtherIcons = "gallery-icons" inURL = request.querystring("URL") inURL = replace(inURL,"\..","") inURL = replace(inURL,"/..","") upURL = inURL file = request.querystring("file") mode="list" if len(file)>0 then mode="view" '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 'FUNCTIONS '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Function TableGallery (counter,gFile,gURL,gType,gSize) counter = counter + 1 if counter = 1 then response.write "" response.write ("") Call DisplayImage (gFile,gURL,gType) response.write ("") if counter = inGallery_TableCol then response.write "" counter = 0 end if End Function Function DisplayImage (gFile,gURL,gType) ' gType = 0 -- File ' gType = 1 -- Folder ' ---------------------------------------------------------- ext2 = empty ext3 = empty ext4 = empty if len(gFile)>2 then ext2 = ucase(right(gFile,2)) if len(gFile)>3 then ext3 = ucase(right(gFile,3)) if len(gFile)>4 then ext4 = ucase(right(gFile,4)) ' ---------------------------------------------------------- ' IF FOLDER THEN SHOW FOLDER ICON if gType=1 then gTarget = "" gLink = inGallery_pageMain & "?URL=" & gURL & "\" & gFile gHTML = "" else ' IF IMAGE SHOW THUMBNAIL if ext3="GIF" or ext3="PNG" or ext3="JPG" or ext4="JPEG" or ext3="BMP" then gTarget = "" gLink = inGallery_pageMain & "?file=" & gFile & "&URL=" & gURL gHTML = "" else '+++++++++++++++++++++++++++++++++++++++++++++++ ' IF NON OF THE ABOVE THEN SHOW ICON '+++++++++++++++++++++++++++++++++++++++++++++++ inGallery_Icon=empty if ext3="ZIP" then ' ZIP inGallery_Icon = "zip.gif" elseif ext3="ISO" then ' CD IMAGE inGallery_Icon = "cdimage.gif" elseif ext3="ASP" then ' CODE inGallery_Icon = "binary.gif" elseif ext3="PHP" then ' PHP inGallery_Icon = "php.gif" elseif ext3="PDF" then ' PDF inGallery_Icon = "pdf.gif" elseif ext3="MP3" or ext3="MP4" or ext3="M1V" or ext3="OGG" or ext3="WAV" then ' SOUND inGallery_Icon = "sound.gif" elseif ext3="MOV" then ' QUICKTIME inGallery_Icon = "quicktime.gif" elseif ext2="RA" or ext2="RM" or ext2="RV" or ext3="RAM" then ' REAL PLAYER inGallery_Icon = "real_doc.gif" elseif ext4="MPG" or ext4="MPEG" or ext3="AVI" then ' VIDEO inGallery_Icon = "video.gif" elseif ext3="TXT" or ext3="RTF" then ' TXT FILE inGallery_Icon = "document2.gif" elseif ext3="DOC" or ext3="PUB" then ' DOC / PUB inGallery_Icon = "wordprocessing.gif" elseif ext3="XLS" then ' SPREADSHEET inGallery_Icon = "spreadsheet.gif" elseif ext3="HTM" or ext4="HTML" or ext3="URL" then ' HTML inGallery_Icon = "html.gif" else inGallery_Icon = "unknown.gif" end if gTarget = "_blank" gLink = inGallery_dirUpload & gURL & "\" & gFile gHTML = "" '+++++++++++++++++++++++++++++++++++++++++++++++ end if end if response.write ("") response.write (gHTML) if inGallery_HideFileName="yes" and gType=0 then ' do nothing else response.write("
" & gFile) end if response.write ("
") End Function Function Thumbnail(inputpath,outputpath,filename) '------------------------------------------------- ext3 = empty if len(filename)>3 then ext3 = ucase(right(filename,3)) if ext3="GIF" or ext3="PNG" or ext3="JPG" then Jpeg.Open(inputpath & "\" & filename) oWidth = Jpeg.OriginalWidth oHeight = Jpeg.OriginalHeight if oWidth>oHeight then sHeight = oHeight / (oWidth / inGallery_ThumbnailMaxWidth) Jpeg.Width = inGallery_ThumbnailMaxWidth Jpeg.Height = sHeight else sWidth = oWidth / (oHeight / inGallery_ThumbnailMaxHeight) Jpeg.Width = sWidth Jpeg.Height = inGallery_ThumbnailMaxHeight end if Jpeg.Save (outputpath & "\" & filename) End If '------------------------------------------------- End Function Function ImageWidth(file) '------------------------------------------------- ext3 = empty if len(file)>3 then ext3 = ucase(right(file,3)) if ext3="GIF" or ext3="PNG" or ext3="JPG" then Jpeg.Open(file) ImageWidth = Jpeg.OriginalWidth Jpeg.Close else ImageWidth = 0 End If '------------------------------------------------- End Function '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 'HTML '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ response.write("") response.write("") response.write("" & inGallery_pageTitle & "") response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") response.write("
") response.write("
") if mode="list" then if len(inURL)>0 then for x=0 to len(inURL) temp1 = right(inURL,x) if instr(temp1,"\") then upURL = left(inURL,len(inURL)-x) exit for end if next if right(upURL,1) = "\" then upURL = left(upURL,len(upURL)-1) end if '############################################ response.write "" response.write "" response.write("") if len(inURL)>0 then response.write "" response.write "" response.write "" response.write "" end if response.write "" response.write "
  Root: " & inURL & "RootUp
" '############################################ response.write("") response.write("") sPath1 = Server.MapPath(".") & "\" & inGallery_dirUpload & inURL sPath2 = Server.MapPath(".") & "\" & inGallery_dirThumb & inURL sPath = sPath1 Set Folder=fso.GetFolder(sPath) for each item in Folder.SubFolders gFile = item.name gURL = inURL counter = counter + TableGallery(counter,gFile,gURL,1,gSize) folders = folders + 1 Next For Each item in Folder.files gFile = item.name gURL = inURL if ucase(gFile) <> "THUMBS.DB" then If fso.FolderExists(sPath2) = false Then set f=fso.CreateFolder(sPath2) set f=nothing end if If fso.FileExists(sPath2 & "\" & gFile) = false then Call Thumbnail(sPath1,sPath2,gFile) end if counter = counter + TableGallery (counter,gFile,gURL,0,gSize) end if files = files + 1 Next if files=0 and folders=0 then response.write("") set fso = Nothing set folder = Nothing Set Jpeg = Nothing end if if mode="view" then response.write "
 
Empty.
" response.write "" response.write("") response.write "" response.write "" response.write "" response.write "
  Gallery: " & inURL & "Back
" '############################################ sPath1 = Server.MapPath(".") & "\" & inGallery_dirUpload & inURL URL = inGallery_dirUpload & inURL & "\" Iwidth = ImageWidth(sPath1 & "\" & file) if Iwidth > 740 then Iwidth = 740 response.write("
") response.write("") if inGallery_HideFileName<>"yes" then response.write(file & "
") response.write("
") response.write("
") response.write("") response.write("") response.write("") response.write("

") end if response.write("") response.write "" response.write "" response.write "" response.write "" response.write "" response.write "
  InGallery v" & inGallery_VersionNumber&" Indecka  
" response.write("
") response.write("") response.write("") Jpeg = Empty fso = Empty %>