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

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 MOD: Avatars Different Sizes
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

The Impact
Junior Member

Australia
398 Posts

Posted - 24 April 2003 :  22:25:31  Show Profile
MOD: Avatars Different Sizes

I often find people want to use the same avatar on all forums but when different forums are using different size avatars this is not always possible.

Here is some changes to the avatar code to make it possible to have the avatars all different sizes.

Instructions

1. Edit the inc_avatar.asp file which is located in your forums directory.
Change this code :
		 		    response.write	"	<img name=""URL"" src=""" & "noavatar.gif"" border=""" & intAvatarBorder & """ height=""" & intAvatarHeight & """ width=""" &  intAvatarWidth & """>"
	    else
		 		    response.write	"	<img name=""URL"" src=""" & rs("M_AVATAR_URL") & """ width=""" & intAvatarWidth & """ height=""" & intAvatarHeight & """ border=""" & intAvatarBorder & """>"
Into this :
		 		    response.write	"	<img name=""URL"" src=""" & "noavatar.gif"" border=""" & intAvatarBorder & """>"
	    else
		 		    response.write	"	<img name=""URL"" src=""" & rs("M_AVATAR_URL") & """ border=""" & intAvatarBorder & """>"
Here I have erased all the scripts knowledge to what the size of this forum's avatars are.

That will update the JScript in the Profile and Register page to change for the size of the image.

2. Now you need to edit the size of the avatars on the topic pages. Edit the file topic.asp which is also located in your forums directory.
Change this code somewhere around line 796.
		 		    response.write"		<img src=""" & Member_Avatar & """ width=""" & intAvatarWidth & """ height=""" & intAvatarHeight & """ border=""" & intAvatarBorder & """>"
Change that to :
		 		    response.write"		<img src=""" & Member_Avatar & """ border=""" & intAvatarBorder & """>"

3. Now stay in your topic.asp for the next change.
Around line 584 change this :
		 		    response.write"		<img src=""" & Reply_MemberAvatar & """ width=""" & intAvatarWidth & """ height=""" & intAvatarHeight & """ border=""" & intAvatarBorder & """>"
Changes to this :
		 		    response.write"		<img src=""" & Reply_MemberAvatar & """ border=""" & intAvatarBorder & """>"

4. Next you need to edit the pop_profile.asp file to update the member's profile pages.
Change this code somewhere near line 305 :
						" 	<td bgColor=""" & strPopUpTableColor & """ align=""center"" colspan=""2""><img src=""" & ChkString(rs("M_AVATAR_URL"), "url") & """ width=""" & intAvatarWidth & """ height=""" & intAvatarHeight & """ border=""" & intAvatarBorder & """></td>" & vbNewLine & _
Into this :
						" 	<td bgColor=""" & strPopUpTableColor & """ align=""center"" colspan=""2""><img src=""" & ChkString(rs("M_AVATAR_URL"), "url") & """ border=""" & intAvatarBorder & """></td>" & vbNewLine & _

5. Now go into your admin_avatar_settings.asp file and delete this which is located around line 113 :
		response.write	"			</b></font></td>" & vbNewLine & _
		"			</tr>" & vbNewLine & _
		"			<tr>"  & vbNewLine & _
		"			<td bgcolor=""" & strPopUpTableColor & """ align=""right"" valign=""middle""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b> Avatar Size: </b></font></td>" & vbNewLine & _
		"			<td bgcolor=""" & strPopUpTableColor & """ align=""center"" valign=""middle""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b> " &_ 
	       "				Height <input name=""intAvatarHeight"" value="""" size=""4"" maxsize=""3"" />" &_
	       "				Width <input name=""intAvatarWidth"" value="""" size=""4"" maxsize=""3"" />"
If you are using an older version of the Avatars Mod you may not have this code. In that case you may just forget this change and the change of the size in the Admin Avatars Settings will have no use.6. The final step in this code is to change the size in the admin_review_avatar.asp file.
Change this which is located around line 116 :
				"<td bgcolor=""" & strForumFirstCellColor & """ align=""center""> <img src=""" & AvatarURL & """ & width=""" & intAvatarWidth & """ height=""" & intAvatarHeight & """ border=""" & intAvatarBorder & """> </td>" & vbNewLine & _
Into this :
				"<td bgcolor=""" & strForumFirstCellColor & """ align=""center""> <img src=""" & AvatarURL & """ border=""" & intAvatarBorder & """> </td>" & vbNewLine & _


That is all the changes which you should have to make. Anyone is welcome to use this small change to the avatars modification and if you encounter and problems along the way please post them and along with other members I'll try to fix your problem.

Details

Changes for Snitz Forums Version 3.4.03
Has been tested on version 3.4.03 and worked fine.
Only some small changes would be needed for other versions.

Bugs / Fixes
Included the changes which I missed in the pop_profile.asp page found by Dave6625.
Also I have added changes of the Avatars Settings page to get rid of the avatar size option.

None at time of posting.

Test Website

You may take a look at this at my website's Snitz discussion forum. If you click on register then accept and you can see how the size changes when selecting different avatars.

PS : This is my first ever real modification I have worked on so please excuse me if I have forgotten or missed out anything.

Cheers, Josh

Edited by - The Impact on 25 April 2003 04:02:30

Dave.
Senior Member

USA
1037 Posts

Posted - 24 April 2003 :  22:50:20  Show Profile
But then the size attribute tags in inc_profile.asp (or is it pop_profile.asp?) don't do anything correct? Shouldn't they be removed?
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 24 April 2003 :  23:26:35  Show Profile
Dave someone please correct me if I'm wrong but the inc_avatar.asp file is actually included in the register and profile page.

This is the page which controls changing the avatars on those pages.
Go to Top of Page

Dave.
Senior Member

USA
1037 Posts

Posted - 24 April 2003 :  23:30:06  Show Profile
Yes (I think), but there are two text fields in the profile page.
Looks like:
Avatar size: [TEXTFIELD] X [TEXTFIELD]

The avatars will be any size regardless of the input into these boxes.
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 24 April 2003 :  23:37:28  Show Profile
Hmm... I think your right Dave.

I'll check it out tonight.
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 25 April 2003 :  04:08:10  Show Profile
I've fixed it and added the instructions for the pop_profile.asp page. There were only some small changes but as I've learn ever a one letter spelling mistake can make the world of a difference.

Also I was not sure whether you were referring to the Avatars Admin page in your last post but I have changed it to take out the Avatar Width and Height since it won't work. I do not think it would be worth taking out the Database values as well.
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 26 April 2003 :  07:06:41  Show Profile
Anyone looking at the changes from a members point of view you can go into http://www.v8impact.com/forums/ and log on as username "Snitz" and password "forum". Please remember this username and password is case sensitive !
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 03 June 2003 :  05:17:12  Show Profile
To avoid any confusion in changing the code on the admin_avatar_settings.asp page I have created a new version of the file which you can use.

http://www.v8impact.com/forums/admin_avatar_settings.txt

Tell me if you have any problems...

Edited by - The Impact on 05 June 2003 03:50:18
Go to Top of Page

filo_2k
Starting Member

Italy
37 Posts

Posted - 03 June 2003 :  07:39:57  Show Profile  Visit filo_2k's Homepage
this mod is very simple, also i did somethig linke this, bit i thouhg that in this way there is no limit to the size, so someone could use an avatar 200x500 that is too big...
how can i set a maximum dimention to the avatars?

filo_2k
Admin @ FastWeb-Italia-NetworK
http://www.fin2k.net
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 05 June 2003 :  03:48:35  Show Profile
Hmmm...

Unless you have users uploading their own avatars this probably wouldn't be a big problem because you could check the size before you add the avatar...

Still it could be a problem... I'm not sure of the way to limit sizes in ASP... Anyone that might be able to help ?
Go to Top of Page

filo_2k
Starting Member

Italy
37 Posts

Posted - 05 June 2003 :  08:35:09  Show Profile  Visit filo_2k's Homepage
i use this avatar mod but i did a little implementation to permit user to choose an avatar form an external url, so the problem of the size is big...

i found a code to control the size of images using server.mappath but if the image is not on the server?
anyone has any idea?


<%
 '***************************************
**********
' adatattamento byluciani
' Dimensioni(0) restituisce X
' Dimensioni(1) restituisce Y
' Dimensioni(2) restituisce profondità di colore
 '***************************************
**********
Dim Dimensioni(2)

 ':::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::
'::: :::
'::: This function gets a specified number of bytes from any :::
'::: file, starting at the offset (base 1) :::
'::: :::
'::: Passed: :::
'::: flnm => Filespec of file to read :::
'::: offset => Offset at which to start reading :::
'::: bytes => How many bytes to read :::
'::: :::
 ':::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::
function GetBytes(flnm, offset, bytes)

Dim objFSO
Dim objFTemp
Dim objTextStream
Dim lngSize

on error resume next

Set objFSO = CreateObject("Scripting.FileSystemObject")

' First, we get the filesize
Set objFTemp = objFSO.GetFile(flnm)
lngSize = objFTemp.Size
set objFTemp = nothing

fsoForReading = 1
Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading)

if offset > 0 then
strBuff = objTextStream.Read(offset - 1)
end if

if bytes = -1 then ' Get All!

GetBytes = objTextStream.Read(lngSize) 'ReadAll

else

GetBytes = objTextStream.Read(bytes)

end if

objTextStream.Close
set objTextStream = nothing
set objFSO = nothing

end function


 ':::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::
'::: :::
'::: Functions to convert two bytes to a numeric value (long) :::
'::: (both little-endian and big-endian) :::
'::: :::
 ':::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::
function lngConvert(strTemp)
lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256)))
end function

function lngConvert2(strTemp)
lngConvert2 = clng(asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256)))
end function


 ':::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::
'::: :::
'::: This function does most of the real work. It will attempt :::
'::: to read any file, regardless of the extension, and will :::
'::: identify if it is a graphical image. :::
'::: :::
'::: Passed: :::
'::: flnm => Filespec of file to read :::
'::: :::
 ':::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::
function gfxSpex(flnm)

dim strPNG 
dim strGIF
dim strBMP
dim strType
strType = ""
strImageType = "(unknown)"

gfxSpex = False

strPNG = chr(137) & chr(80) & chr(78)
strGIF = "GIF"
strBMP = chr(66) & chr(77)

strType = GetBytes(flnm, 0, 3)

if strType = strGIF then ' is GIF

strImageType = "GIF"
Width = lngConvert(GetBytes(flnm, 7, 2))
Height = lngConvert(GetBytes(flnm, 9, 2))
Depth = 2 ^ ((asc(GetBytes(flnm, 11, 1)) and 7) + 1)
gfxSpex = True

elseif left(strType, 2) = strBMP then ' is BMP

strImageType = "BMP"
Width = lngConvert(GetBytes(flnm, 19, 2))
Height = lngConvert(GetBytes(flnm, 23, 2))
Depth = 2 ^ (asc(GetBytes(flnm, 29, 1)))
gfxSpex = True

elseif strType = strPNG then ' Is PNG

strImageType = "PNG"
Width = lngConvert2(GetBytes(flnm, 19, 2))
Height = lngConvert2(GetBytes(flnm, 23, 2))
Depth = getBytes(flnm, 25, 2)

select case asc(right(Depth,1))
case 0
Depth = 2 ^ (asc(left(Depth, 1)))
gfxSpex = True
case 2
Depth = 2 ^ (asc(left(Depth, 1)) * 3)
gfxSpex = True
case 3
Depth = 2 ^ (asc(left(Depth, 1))) '8
gfxSpex = True
case 4
Depth = 2 ^ (asc(left(Depth, 1)) * 2)
gfxSpex = True
case 6
Depth = 2 ^ (asc(left(Depth, 1)) * 4)
gfxSpex = True
case else
Depth = -1
end select


else

strBuff = GetBytes(flnm, 0, -1) ' Get all bytes from file
lngSize = len(strBuff)
flgFound = 0

strTarget = chr(255) & chr(216) & chr(255)
flgFound = instr(strBuff, strTarget)

if flgFound = 0 then
exit function
end if

strImageType = "JPG"
lngPos = flgFound + 2
ExitLoop = false

do while ExitLoop = False and lngPos < lngSize

do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos < lngSize
lngPos = lngPos + 1
loop

if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff, lngPos, 1)) > 195 then
lngMarkerSize = lngConvert2(mid(strBuff, lngPos + 1, 2))
lngPos = lngPos + lngMarkerSize + 1
else
ExitLoop = True
end if

loop
'
if ExitLoop = False then

Width = -1
Height = -1
Depth = -1

else

Height = lngConvert2(mid(strBuff, lngPos + 4, 2))
Width = lngConvert2(mid(strBuff, lngPos + 6, 2))
Depth = 2 ^ (asc(mid(strBuff, lngPos + 8, 1)) * 8)
gfxSpex = True

end if

end if

Dimensioni(0) = Height
Dimensioni(1) = Width
Dimensioni(2) = Depth
end function


 '***************************************
 ****************************************
*****************
%>



<%
NomeImmagine = "tuaimmagine.jpg"
'esempio con dimensioni obbligatorie di 400x300 pixel
If gfxSpex(Server.MapPath(nomefile)) then 
		If Dimensioni(1) <> 400 AND Dimensioni(0) <> 300 Then
Response.Write "Foto di dimensioni errate (" & Dimensioni(1) & "x" & Dimensioni(0) & " pixel)"
Else
Response.Write "Foto di dimensioni esatte!!!"
End If
Else
Response.Write "Foto non compatibile (estensione errata)"
End If
%>

filo_2k
Admin @ FastWeb-Italia-NetworK
http://www.fin2k.net

Edited by - filo_2k on 08 June 2003 13:44:52
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.26 seconds. Powered By: Snitz Forums 2000 Version 3.4.07