• 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

tekboi

Active member
#1
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?
 

dawg

Well-known member
#2
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.
 

HWS

Well-known member
#3
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?
Change the size to "l" and define the exact site with CSS (width:150px;height:150px;).
 

Mr Lucky

Well-known member
#7
so I just target.... "l" with css? Sorry if i'm being a pain. I'm still learning alot of stuff.
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

Code:
.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

Code:
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'

Code:
'l' => 150,
In template message_user_info

change size from "m" to "l"

Code:
<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: