1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

avatar.php 1.1.2a

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

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff 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" />

    Read more about this resource...
     
  2. Brentnauer

    Brentnauer Well-Known Member

    My account here uses a Gravatar, let me know what you need and I'll do whatever I can to help.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
    aiman.h.kallaf likes this.
  4. ineedhelp

    ineedhelp Well-Known Member

    I don't quite understand the concept, can you explain a little more or show image examples, please?
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
    aiman.h.kallaf and Brentnauer like this.
  6. ineedhelp

    ineedhelp Well-Known Member

    ^^^Ic, thanks..
     
  7. Andrew

    Andrew Well-Known Member

    Hi Jake,

    Does this allow you to place an avatar on a XenForo page?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It can. But within XenForo pages it is best to use the xen:avatar syntax in the templates when you can. xen:avatar works when the user record is available.
     
    Brentnauer likes this.
  9. Brentnauer

    Brentnauer Well-Known Member

    I requested this mostly for use within AddonChat to display user avatars.

    Since AddonChat has no ability to hook in to the template system, this is a perfect use-case.
     
    Jake Bunce likes this.
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Brentnauer likes this.
  11. Brentnauer

    Brentnauer Well-Known Member

    How hard would it be to implement some kind of cache?
     
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Floris and Brentnauer like this.
  13. bashy

    bashy Member

    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 ;)
     
    Floris likes this.
  14. Brentnauer

    Brentnauer Well-Known Member

  15. bashy

    bashy Member

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

    Jake Bunce XenForo Moderator Staff Member

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

    "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.
     
  17. bashy

    bashy Member

    Yeah saw it in the array, doesn't matter now, I used width="" and height="" in the img tag
     
  18. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  19. Dinh Thanh

    Dinh Thanh Well-Known Member

  20. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Why do you need a route? A proper route seems unnecessary to me.
     

Share This Page