% @Language = "VBscript" %> <% '==================================================================== 'Copyright (C) 2004 VirtualFlair.com '==================================================================== 'The script is licensed as follows: 'You may copy, display and modify the script as long as all copyright 'notices and comments by the original author remains intact. 'You may distribute the script in the original unaltered version only 'for non-commercial use and without profiting by it. 'If you wish to distribute an altered version of the script for 'non-commercial or commercial use you are obligated to contact the 'original author of the script and get his/hers consent. '==================================================================== %> <% Public Sub printGallery() Call initiateGallery() Call printImages() Call printPaging() End Sub Dim intTotalItems, intCurrentPage, intStartItem, arrItems Sub initiateGallery() '==========paging========== intCurrentPage = Request.QueryString("page") If intCurrentPage = "" Or Int(intCurrentPage) = 0 Then intCurrentPage = 1 End If intStartItem = (((intCurrentPage - 1) * itemsPerPage) + 1) If Int(intStartItem) = 0 Then intStartItem = 1 End If '==========get images========== '==> Dim objFso, objFolderFiles Set objFso = Server.CreateObject("Scripting.FileSystemObject") Set objFolderFiles = objFso.GetFolder(Server.MapPath(imageDirectory)) allowedImageTypes = Split(allowedImageTypes, ",") Dim objItem, i, bolFileExtensionAllowed For Each objItem In objFolderFiles.files bolFileExtensionAllowed = 0 '==========check if file extension is allowed========== For i = 0 To UBound(allowedImageTypes) If LCase(objFso.GetExtensionName(objItem)) = LCase(Trim(allowedImageTypes(i))) Then bolFileExtensionAllowed = 1 Exit For End If Next '==========add image to "arrItems"========== If bolFileExtensionAllowed = 1 Then intTotalItems = (intTotalItems + 1) If Int(intStartItem) <= Int(intTotalItems) And Int(intTotalItems) < Int(intStartItem + itemsPerPage) Then If arrItems = "" Then arrItems = arrItems & objItem.Name Else arrItems = arrItems & "," & objItem.Name End If End If End If Next Set objFolderFiles = Nothing Set objFso = Nothing '<== End Sub Sub printImages() arrItems = split(arrItems, ",") Response.Write ("