Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Current Version (Old)
 Avatar resizing...
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Old Ager
New Member

Italy
59 Posts

Posted - 19 June 2001 :  10:01:13  Show Profile  Visit Old Ager's Homepage  Send Old Ager an ICQ Message
I have the avatar MOD installed and the max size is set to 64x64. Unfortunately, if someone is using an avatar that is 64hx48w, it is resized to 64x64. Is there a way around this?

Old Ager

dayve
Forum Moderator

USA
5820 Posts

Posted - 19 June 2001 :  11:57:00  Show Profile  Visit dayve's Homepage
yes there is. I have incorporated proportional avatars at my site with some really cool backend programming provided to me by Iron Heart at http://www.someplacesomewhere.com

I will collect all the information you need to know and will post it in the Mod W/Code area because I think a lot of people will want this. In the menatime check out some of the avatars at my site:

http://www.nineinchnailz.com/forum

It really is a fantastic feature...

Dayve
Go to Top of Page

Old Ager
New Member

Italy
59 Posts

Posted - 19 June 2001 :  18:46:48  Show Profile  Visit Old Ager's Homepage  Send Old Ager an ICQ Message
Thanks, Dayve. nice lookin' boards BTW.

Old Ager
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 20 June 2001 :  00:52:41  Show Profile  Visit dayve's Homepage
thanks to Iron Heart of http://www.someplacesomewhere.com

1. In topic.asp find the place where all the Subs are located. Add this sub to there:


Sub GetPicFileInfo( i_sFilename, o_PicType, o_nWidth, o_nHeight )

i_sFilename = replace(i_sFilename, "/", "\", 1, -1, 1)
o_PicType = ""
o_nWidth = 0
o_nHeight = 0

Dim fso, ts
Dim GIF_MARKER, JPG_MARKER

GIF_MARKER = "GIF8"
JPG_MARKER = Chr(&HFF) & Chr(&HD8) & Chr(&HFF) & Chr(&HE0)

Set fso = CreateObject("Scripting.FileSystemObject")

On Error Resume Next

Set ts = fso.OpenTextFile(Server.MapPath("/forum/" & i_sFilename))

If Err.Number <> 0 Then
Err.Clear
Set ts = fso.OpenTextFile("/forum/error.gif")
End if

Select Case ts.Read(4)
Case GIF_MARKER
o_PicType = "GIF"
ts.Skip(2)
If Err.Number <> 0 Then
Exit Sub
End If
o_nWidth = Asc(ts.Read(1)) + ( Asc(ts.Read(1))* 256 )
o_nHeight = Asc(ts.Read(1)) + ( Asc(ts.Read(1))* 256 )

Case JPG_MARKER
o_PicType = "JPG"

Dim byteVal, bDone
bDone = False
byteVal = Asc(ts.Read(1))
Do While Not ts.AtEndOfStream And byteVal <> &HD8 And Not bDone
'look for the next marker (xFF)
Do While Not ts.AtEndOfStream And byteVal <> &HFF
byteVal = Asc(ts.Read(1))
Loop

'Get past any repeated xFF markers
Do While Not ts.AtEndOfStream And byteVal = &HFF
byteVal = Asc(ts.Read(1))
Loop

'Check out the marker
'if this is the width/height section then read the values
If ((byteVal >= &HC0) And (byteVal <= &HC3)) Then
ts.Skip(3)
If Err.Number <> 0 Then
Exit Sub
End If
If Not ts.EOF Then
o_nHeight = (Asc(ts.Read(1)) * 256) + Asc(ts.Read(1))
o_nWidth = (Asc(ts.Read(1)) * 256) + Asc(ts.Read(1))
bDone = True
End If
Else
'this is a comment or other stuff we are not interested in.
'we must read the size and then skip over this section
Dim nSectionLength
nSectionLength = (Asc(ts.Read(1)) * 256) + Asc(ts.Read(1))

'NOTE: we subtract two since from the size since we already
'are past the length bytes which are included in the size
ts.Skip(nSectionLength - 2)
byteVal = Asc(ts.Read(1))

If Err.Number <> 0 Then
Exit Sub
End If
End If
Loop
End Select

if o_nWidth > 64 or o_nHeight > 64 then
if o_nHeight > o_nWidth then
o_nWidth = cInt(o_nWidth * 64/o_nHeight)
o_nHeight = 64
if (o_nWidth < 64 and o_nWidth > 26) then
o_nHeight = cInt(o_nHeight * 64/o_nWidth)
o_nWidth = 64
else
o_nWidth = cInt(o_nWidth * 100/o_nHeight)
o_nHeight = 100
end if
else
o_nHeight = cInt(o_nHeight * 64/o_nWidth)
o_nWidth = 64
end if
end if
response.write " width=""" & o_nWidth & """ height=""" & o_nHeight & """"
Set ts = Nothing
Set fso = Nothing
End Sub


2. Do a search for <img src="<% =rs("M_AVATAR_URL") %>"

Delete this tag's width & height settings. Replace them with <%Call GetPicFileInfo(rs("M_AVATAR_URL"), 0, 0, 0)%>

I can let you know that I've been using this for awhile now and it is the best thing ever when it comes to avatars. I've incorporated a mod so members can upload their own avatars using the Upload Mod as well and it fits in nicely with the above script. Just have patience although it is quite easy to install.

I can only provide minimal support on this so please do not email me. I can point you to a link where Iron Heart helped me with this and other issues.

Avatars Upload/Proportionalize Topic

This guy is really smart.....



Dayve
Go to Top of Page

sennan
Starting Member

Australia
21 Posts

Posted - 23 June 2001 :  21:39:31  Show Profile  Visit sennan's Homepage  Send sennan an ICQ Message
urk. this mod APPEARS to be working, but all i get displayed is a teeny tiny 1 x 1 pixel avatar image

i'll have to send an email to IH asking for assistance.

-=[ http://forums.sennan.net ]=-
Go to Top of Page

sennan
Starting Member

Australia
21 Posts

Posted - 23 June 2001 :  22:01:38  Show Profile  Visit sennan's Homepage  Send sennan an ICQ Message
uh, nevermind. i worked it out, tis cool now.

-=[ http://forums.sennan.net ]=-
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07