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

XF 1.3 Custom Avatar size next to Posts

Discussion in 'Styling and Customization Questions' started by tekboi, Jul 23, 2014.

  1. tekboi

    tekboi Active Member

    I have widened the user info block and adjusted the postbit area to accommodate for longer usernames and bigger avatars in my theme. But How to I adjust the avatar size next to the posts w/ a custom size. I want them to be 150 x 150. I know about changing the template from "m" to "l" but that makes the avatars way too big.

    How can I add a custom size to the avatars next to posts?
  2. dawg

    dawg Well-Known Member

    You should get professional help. @napy8gen did my custom styling and i highly recommend him. He is a very hard worker. I have large animated avatars on my site.
  3. HWS

    HWS Well-Known Member

    Change the size to "l" and define the exact site with CSS (width:150px;height:150px;).
  4. tekboi

    tekboi Active Member

    where is the variable "l" defined so I know where to customize it?
  5. HWS

    HWS Well-Known Member

    This cannot be customized currently without modifying a core file or very heavily add-on coding (not recommended).

    Use CSS and everything will be good. ;-)
    dawg likes this.
  6. tekboi

    tekboi Active Member

    so I just target.... "l" with css? Sorry if i'm being a pain. I'm still learning alot of stuff.
  7. Mr Lucky

    Mr Lucky Well-Known Member

    I'd like to know this too. If you inspect the element of the avatar (img) there is no class.

    However there is this in xenforo.css, but changing those seems to do nothing

    .avatar .img.s { width: 48px;  height: 48px;  }
        .avatar .img.m { width: 96px;  height: 96px;  }
        .avatar .img.l { width: 192px; height: 192px; }
    Then there is this Avatar.php

    class XenForo_Model_Avatar extends XenForo_Model
         * List of available avatar sizes. The largest must go first.
         * Avatars of each size code (directory name) will be no bigger
         * than the given pixel amount.
         * @var array Format: [code] => max pixels
        protected static $_sizes = array(
            'l' => 150,
            'm' => 96,
            's' => 48
    However changing the size upward, e.g. 'm' to 150 shows the 96px image expanded to 150, so poor quality.

    It may work to use size 'l' but reduced.

    Edit: Yes this seems to work for changing message avatar to 150px:

    In file library > Xenforo > Model > Avatar.php

    change size of 'l'

    'l' => 150,
    In template message_user_info

    change size from "m" to "l"

    <xen:avatar user="$user" size="l" img="true" />
    In Style properties message layout:

    User info container width 180px
    Content container left margin:300px
    Last edited: Dec 15, 2015

Share This Page