MyBB Community Forums

Full Version: Profile Picture under username
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a question regarding my website (inVisionary) which is very pre-beta! (www.daedricprince.byethost17.com)

My question is, how can I have the user's profile picture show up under the user's username? (example picture below)

Thanks! Smile
This will call the user's avatar for you:

<img src="{$mybb->user['avatar']}" alt="{$mybb->user['username']}" title="{$mybb->user['username']}" />

Add this in 'header_welcomeblock_member' template to suitable location.
(2013-01-06, 08:37 PM)effone Wrote: [ -> ]This will call the user's avatar for you:

<img src="{$mybb->user['avatar']}" alt="{$mybb->user['username']}" title="{$mybb->user['username']}" />

Add this in 'header_welcomeblock_member' template to suitable location.

Thanks! Apparently the picture is too large to fit, unfortunately.
There is solution for that too.

Add this (with the class):

<img class="avatar" src="{$mybb->user['avatar']}" alt="{$mybb->user['username']}" title="{$mybb->user['username']}" />

Now add this to global.css:

.avatar {
	height: 50px;
	width: 50px;
}

Or

You can directly hardcode the style also:

<img style="height: 50px; width: 50px;" src="{$mybb->user['avatar']}" alt="{$mybb->user['username']}" title="{$mybb->user['username']}" />

Change the px values as per requirement.
I think it'd be better to use the max-height and max-width attributes instead so it'd only resize ones that are larger than the dimensions otherwise it could stretch images.
I've shown the way. Now deal with it as you like.
On that particular position it is sometimes required to stretch as well along with the shrink to maintain a fixed size in order to preserve layout.