Print Page | Close Window

Avatar size?

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=19717
Printed Date: 28 March 2026 at 7:53am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Avatar size?
Posted By: bad5star
Subject: Avatar size?
Date Posted: 04 May 2006 at 8:00pm
I have searched this forum for the answer and see alot on avatar but I dont see the solution.

Here is my question

How can I have an avatar display of any size and just set a max width and height in the  default_style.css page.

ie. If I have an avatar of 45x50 I dont want it to stretch to my settings of 64x64.

I just want to set a max width and height and let user put any size avatar in their and at the same time not let it get stretched or distorted?

any ideas?

B5




Replies:
Posted By: venki
Date Posted: 04 May 2006 at 10:15pm
It is very hard to detect picture size whit asp, maybe it could be done by javascript, and I dont think that you can set max width and height whit css...


Posted By: yuroun
Date Posted: 05 May 2006 at 10:20pm
I found this javascript somewhere. I think it's from an old mod of MadDog.

Put this in includes/default_javascript.js

function ControlImageSize() {
  if (document.images.length > 0) {        // images?
    var imgHeight;
    var imgWidth;
    for (var i = 0; i < document.images.length; i++) {
      if (document.images.name.substring(0,6) == 'chkImg')     {
        imgWidth = document.images.width;
        imgHeight = document.images.height;
        if (imgWidth > 55) {
          document.images.width = 50;
          // Change the height proportionally
          imgHeight =  imgHeight / (imgWidth/50);
          document.images.height = imgHeight;
        }
      }
    }
  }
}


And at line 848 replace            

If blnAvatar = True AND strAuthorAvatar <> "" Then Response.Write("<img src=""" & strAuthorAvatar & """ alt=""" & strTxtAvatar & """ class=""avatar"" onError=""this.src='avatars/blank_avatar.jpg';""/>")

With


If blnAvatar = True AND strAuthorAvatar <> "" Then Response.Write("<img src=""" & strAuthorAvatar & """ alt=""" & strTxtAvatar & """ class=""avatar"" id=""chkImg1"" name=""chkImg2"" onError=""this.src='avatars/blank_avatar.jpg';""/>")

And play a bit with the ControlImageSize settings. This should work.


Posted By: tw|kosh
Date Posted: 07 May 2006 at 11:47pm
I've found the way below to find out which image has which dimensions. I've not the time to integrate it with WWF, but I think it should work.
 
I've downloaded the test-script and changed it to search the forum/smileys directory. The result: http://board.teraweb.ch/user/imagespecs.asp - http://board.teraweb.ch/user/imagespecs.asp
 
I think with this script all avater sizes should be "hard-coded" directly in the asp and the CSS height/width arguments should me deleted...
(thats just the first idea I had)
 
Read more:
http://www.4guysfromrolla.com/webtech/050300-1.shtml - http://www.4guysfromrolla.com/webtech/050300-1.shtml
 
Greets
Chris



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