Author |
Topic |
|
Old Ager
New Member
Italy
59 Posts |
Posted - 19 June 2001 : 10:01:13
|
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
|
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 |
|
|
Old Ager
New Member
Italy
59 Posts |
Posted - 19 June 2001 : 18:46:48
|
Thanks, Dayve. nice lookin' boards BTW.
Old Ager |
|
|
dayve
Forum Moderator
USA
5820 Posts |
Posted - 20 June 2001 : 00:52:41
|
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 |
|
|
sennan
Starting Member
Australia
21 Posts |
Posted - 23 June 2001 : 21:39:31
|
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 ]=- |
|
|
sennan
Starting Member
Australia
21 Posts |
|
|
Topic |
|