Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - MOD : Pop Up Avatar Gallery
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MOD : Pop Up Avatar Gallery

 Post Reply Post Reply
Author
stained View Drop Down
Newbie
Newbie
Avatar

Joined: 19 January 2007
Location: United Kingdom
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote stained Quote  Post ReplyReply Direct Link To This Post Topic: MOD : Pop Up Avatar Gallery
    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
Back to Top
cfilut View Drop Down
Newbie
Newbie


Joined: 24 February 2005
Location: United States
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote cfilut Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
stained View Drop Down
Newbie
Newbie
Avatar

Joined: 19 January 2007
Location: United Kingdom
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote stained Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
cfilut View Drop Down
Newbie
Newbie


Joined: 24 February 2005
Location: United States
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote cfilut Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
stained View Drop Down
Newbie
Newbie
Avatar

Joined: 19 January 2007
Location: United Kingdom
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote stained Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2007 at 9:12am
glad you got it working Big%20smile
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.