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

XF 1.2 Resize Placeholder Avatar

#1
I'm trying to find a way of changing the placeholder avatar.

At the moment the code is like this:
Code:
<img src="styles/default/xenforo/avatars/avatar_m.png" width="96" height="96" alt="member" />
I want to remove the line altogether, add a display: none, or change it to
Code:
<img src="styles/default/xenforo/avatars/avatar_m.png" width="1" height="1" alt="member" />
I don't want to change custom avatars that members have loaded.

Stuck as always. Where should I be looking?
 

EQnoble

Well-known member
#2
I would not just remove it or display:none it nor would I make it a 1px by 1px thing...it will end up looking like this.
gfafdf.png
In any case the template you are looking for is message_user_info

So if a user has not chose an avatar what are you trying to display other than the default avatar?
 
#3
That's what I am trying to achieve. If the member hasn't loaded an avatar I would prefer the avatar space to collapse.

The template allows me to remove ALL avatars, but does not allow me just to remove the placeholder ones.
 
#4
Got it. After several hours. Thanks to everyone in the big and tall avatars thread

In message_user_info template change "m" to "l" to get rid of the html controls making avatars 96px square.
Code:
 <xen:avatar user="$user" size="l" img="true"  />
I've gone for 80px width and whatever height the avatar is which gets rid of a lot of the blurred avatar look from vB imports..

In extras.css template I copied from the thread linked at the top
Code:
/* == AVATAR ADJUSTMENTS == */
.thread_view .messageList .messageUserInfo a.avatar img,
.thread_view .quickReply .messageUserInfo a.avatar img,
.conversation_view .messageList .messageUserInfo a.avatar img,
.conversation_view .quickReply .messageUserInfo a.avatar img,
.avatar img, .avatar .img, .avatarCropper
{
    max-width: 80px;
    height: auto;
}
In message_user_info.css template change from fixed sizes for mobile view.
Code:
        .Responsive .messageUserBlock div.avatarHolder .avatar img
        {
            width: 80px;
            height: auto;
        }
Finally in the folder styles/yourstyle/xenforo/avatars replace the images with a 100px * 1px .png image which now allows the avatar box to collapse if there is no avatar.

Some further fiddling with .css templates could make it look like there were never any placeholder avatars and reduce wasted space when viewing threads. I've got this:

Capture.GIF

Beware there are knock-on effects. Adding avatars is tricky as users would then be required to click on a 1px background coloured image. More template mods needed.
 
Last edited: