Resource icon

avatar.php 1.1.2a

No permission to download

Jake Bunce

Well-known member
Jake Bunce submitted a new resource:

avatar.php (version 1.1.2) - Loads a user's avatar image by GET params. For example, <img src="avatar.php?userid=1" />

This script is useful when you have any HTML web page needing to show a user's avatar, and the user's username or userid is available to you. An HTML img tag will be the typical usage:

Code:
<img src="avatar.php?userid=3" />

Installation:
- upload this script to your forum root. :coffee:

You have 3 GET parameters you can set:

userid - the userid number of the user.
username - the username of the user. Can be used instead of userid.
size - can be s, m,...

Read more about this resource...
 
My account here uses a Gravatar, let me know what you need and I'll do whatever I can to help.

I just don't like to sign up for services that I don't use.

Gravatar appears to only require an email address? If you give me your email then I can input it into my test forum. That may work for testing.
 
I don't quite understand the concept, can you explain a little more or show image examples, please?

If this file was uploaded on xenforo.com then this URL:

http://xenforo.com/community/avatar.php?userid=9

Would show this image (my avatar):

http://xenforo.com/community/data/avatars/m/0/9.jpg

It's useful when you only have the userid or username of the user. It is especially useful when you need to display avatars on external pages that are not part of XenForo.
 
Thanks for this, couldn't get my head around how <xen:avatar> got the size/styling and I had a hard time changing it for my needs, this little add-on lets me do my own thing ;)
 
I tried examining the signature badge script that was released here a while back and I can't figure it out either :(

I have a few things to try, I just haven't got around to it yet.

It's working great but I'm not sure where it gets the sizing for?
Where does it store s/m/l settings?

"size" is a GET parameter. The values you can use are s, m, and l. That value isn't stored anywhere in the user record. Rather it's something you specify when calling an avatar.
 
"size" is a GET parameter. The values you can use are s, m, and l. That value isn't stored anywhere in the user record. Rather it's something you specify when calling an avatar.
Yeah saw it in the array, doesn't matter now, I used width="" and height="" in the img tag
 
Yeah saw it in the array, doesn't matter now, I used width="" and height="" in the img tag

Oh. You want this:

Admin CP -> Appearance -> Templates -> xenforo.css

Code:
	.avatar .img.s { width: 48px;  height: 48px;  }
	.avatar .img.m { width: 96px;  height: 96px;  }
	.avatar .img.l { width: 192px; height: 192px; }

That is where the sizes are defined. But changing these sizes is a little more involved. Of course img tag attributes are an easy solution.
 
Top Bottom