|
I'd seen this on another forum and did a little reverse engineering to come up with an avatar gallery script which i needed for a site using 2000+ avatar images .
comes with no warranties but I'll try my best to trouble shoot. I'm not taking credit for this only a couple of days work to get it running with web wiz.
works with the current version of web wiz (8.05a).
The script reads all files in a directory, skipping over any files that are not jpg, or gif's (you can change trhis in the script if needed). It also displays the file name under the image.
copy the following code into a file in the main forum folder called list_avatars.asp
2 variables need to be edited for this to work.
strAvatarUrl = this is the url to the folder of the avatar images
strAvatarUrl = http path to image directory
need a slash at the end of both of these.
[code] <% @ Language=VBScript %> <% Option Explicit %> <!-- #include file="common.asp"--> <!-- #include file="functions/functions_filters.asp"--> <% '**************************************************************************************** '** '** Avatar Gallery Script For Web Wiz Forums V8.05 '** '** Dean Clayton '** '** 2007 '** '****************************************************************************************
response.Write "<html><head><title>Avatar Gallery v2.5</title>" response.Write "<link href="""& strCSSfile &"default_style.css"" rel=""stylesheet"" type=""text/css"" />" %>
<script language="JavaScript"> function setAvatar(strAvatar){ var frmObj = window.opener.document.frmRegister var imgObj = window.opener.document.images if(strAvatar.indexOf("http://")==0){ frmObj.txtAvatar.value=strAvatar; }else{ frmObj.txtAvatar.value=""; } frmObj.oldAvatar.value=""; frmObj.SelectAvatar.value=strAvatar; imgObj.avatar.src=strAvatar; window.close(); } </script> <style type="text/css"> td { background: no-repeat fixed center; } </style> </head><body> <% Dim strAvatarPath,strAvatarUrl, fso, strInput Dim intColspan Dim saryAvatars,x,intAvatarsPerRow,intAvatarNr,intTotalAvatars,intTotalSubdirs Dim fsoAvatarFolder,fsoAvatarCollection,AvatarFile,fsoSubfolders,Subdir Set fso = Server.CreateObject("Scripting.FileSystemObject") Set strAvatarPath = fso.GetFolder(Server.MapPath("/images folder from site root/")) Set fso = Nothing intAvatarsPerRow = 5 strAvatarUrl = "http://www.site.com/url to images/" Set fso = CreateObject("Scripting.FileSystemObject") Set fsoAvatarFolder = fso.GetFolder(strAvatarPath) Set fsoAvatarCollection = fsoAvatarFolder.Files intTotalAvatars = 0 For Each AvatarFile In fsoAvatarCollection intTotalAvatars = intTotalAvatars + 1 Next If intTotalAvatars<intAvatarsPerRow Then intColspan = intTotalAvatars Else intColspan = intAvatarsPerRow End If Dim pageNo, avatarsPerPage, maxPage pageNo = Int(Request.QueryString("pageNo")) if pageNo < 1 then pageNo = 1 avatarsPerPage = Int(Request.QueryString("app")) if avatarsPerPage < 1 then avatarsPerPage = intAvatarsPerRow * 8 maxPage = Int((intTotalAvatars-1) / avatarsPerPage)+1 if pageNo > maxPage then pageNo = maxPage Response.Write "<table class=""basictable"" align=""center"">" Response.Write "<tr class=""tableledger"" ><td colspan=" & intAvatarsPerRow & " align=""center"">" Response.Write "<b>" & intTotalAvatars & "</b> Avatars Found.<br> " if pageNo > 1 then response.write "<a href=""list_avatars.asp?pageNo=" & pageNo-1 & "&app=" & avatarsPerPage & "&subdir=" & Server.URLEncode(Request.QueryString("subdir")) & """>«</a>" response.Write " <form>Page <select onChange=""window.location=this.options[this.selectedIndex].value;"">" For x = 1 to maxpage response.write "<option value=""list_avatars.asp?pageNo=" & x & "&app=" & avatarsPerPage & "&subdir=" & Server.URLEncode(Request.QueryString("subdir")) & """ " if x = pageNo then response.write "SELECTED" response.Write ">"& x &"</option>" & vbCrLf Next response.Write "</select></form> of " & maxPage & " " if pageNo < maxPage then response.write "<a href=""list_avatars.asp?pageNo=" & pageNo+1 & "&app=" & avatarsPerPage & "&subdir=" & Server.URLEncode(Request.QueryString("subdir")) & """>»</a>" response.Write "</td></tr>" Redim saryAvatars(2,intTotalAvatars) x = 0 For Each AvatarFile in fsoAvatarCollection saryAvatars(0,x) = AvatarFile.Name x = x + 1 Next Response.Write "<tr class=""tablerow"">" dim bigAv bigAv = avatarsPerPage*pageNo-1 if bigAv > UBound(saryAvatars,2)-1 then bigAv = UBound(saryAvatars,2)-1 For x = (avatarsPerPage*(pageNo-1)) to bigAv if saryAvatars(0,x) <> "Thumbs.db" then Response.Write "<td align=center STYLE=""background: url(" & strAvatarUrl & saryAvatars(0,x) & "); background-repeat: no-repeat; background-position: top center"">" Response.Write "<a href=""JavaScript:setAvatar('" & strAvatarUrl & saryAvatars(0,x) & "');""><img src=""http://www.uncannyxmen.net/images/nuthin.gif"" width=90 height=100/>" '<img src=""" & strAvatarUrl & saryAvatars(0,x) & """ border=""0"" style=""border:1px solid black;"" />" strInput = Replace(saryAvatars(0,x), ".jpg", "") strInput = Replace(strInput, ".jpeg", "") strInput = Replace(strInput, ".JPG", "") strInput = Replace(strInput, ".JPEG", "") strInput = Replace(strInput, "_", " ") strInput = Replace(strInput, "-", " ") Response.Write "<br>"& strInput &"</a></td>" intAvatarNr = intAvatarNr + 1 I
|