Print Page | Close Window

MOD : Pop Up Avatar Gallery

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums Modifications
Forum Description: Mod's and Add-on's for Web Wiz Forums.
URL: https://forums.webwiz.net/forum_posts.asp?TID=23224
Printed Date: 29 March 2026 at 4:24am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: MOD : Pop Up Avatar Gallery
Posted By: stained
Subject: MOD : Pop Up Avatar Gallery
Date Posted: 30 April 2007 at 10:07pm
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")) & """>&laquo;</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 & "&nbsp;"
    if pageNo < maxPage then response.write "<a href=""list_avatars.asp?pageNo=" & pageNo+1 & "&app=" & avatarsPerPage & "&subdir=" & Server.URLEncode(Request.QueryString("subdir")) & """>&raquo;</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



Replies:
Posted By: cfilut
Date Posted: 27 June 2007 at 9:15pm
hi stained, I tried your mod but ended up with
 
 

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/forum/list_avatars.asp, line 1

Dim strAvatarPath,strAvatarUrl, fso, strInput    Dim intColspan 
 
Any suggestions?


-------------
You are what you eat, So stay away from the jerk chicken.


Posted By: stained
Date Posted: 28 June 2007 at 10:35am
it looks like you've copied the code incorrectly.

the message youve pasted shows 2 dim statements on the same line, which you shouldn't have.

if need be send me a pm with you're email address and i'll send you a zip file with the list_avatars.asp file included.


Posted By: cfilut
Date Posted: 28 June 2007 at 10:13pm
I PM'ed you, but I have figured it out since...the copy and paste did not work, the file above was all jumbled when I pasted it.  It finally pasted correctly into word pad, then I copied it from word pad into my page and everything worked correctly.  Thanks, this is exactly what I was looking for and it looks great.  Top Notch stuff.Thumbs%20Up

-------------
You are what you eat, So stay away from the jerk chicken.


Posted By: stained
Date Posted: 29 June 2007 at 9:12am
glad you got it working Big%20smile



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net