MyBB Community Forums

Full Version: {avatar} stretching avatars
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I'm looking for a way in which to make the avatar that appears in my welcomeblock to adjust the avatar image like it does anywhere else in MyBB. Currently it's distorting the dimensions making them either very wide or squished depending on the images dimensions. A test account can be setup upon request so you can see what I'm talking about (if I'm unclear).

Thanks everyone Smile

EDIT:
Here's my header template where the avatar is being called into use. If anyone can advise on how to get it to resize smartly for lack of a better term.

<div id="container">
        <a name="top" id="top"></a>
        <div id="header">
<div style="margin-top: 10px; margin-left: 8px; margin-bottom: -30px; text-align: left;"><a href="{$mybb->settings['bburl']}/index.php"><img src="images/logo.png" /></a></div>      

            <br /><div id="panel" style="float: right; margin-top: -95px; margin-right: 120px">{$welcomeblock}</div>
            <div style="border-radius: 5px; -webkit-border-radius: 5px;
-moz-border-radius: 5px; float: right; padding-right:
10px; margin-top: -125px;"><a href="{$mybb->settings['bburl']}/usercp.php">{$avatar}</a></div>
            <hr class="hidden" />
<br />
</div>
        <hr class="hidden" />
        <br class="clear" />
        <div id="content">
            {$pm_notice}{$teradonate_notice}{$teradonate_bar}
            {$bannedwarning}
            {$bbclosedwarning}
            {$unreadreports}
{$headerannounce}
            {$pending_joinrequests}
            <navigation>
            <br />
I guess {$avatar} code is evaluating inside any core file like global.php , right ? If so then you've to assign a width and height attributes in the <img src> tag, like this;
$avatar = '<img src="'.$mybb->user['avatar'].'" height="63px" width="63px" alt="Avatar">';

Edit 63 in both width and height attributes for your desired sizes. Smile
If you want to resize them proportionally, you should use something like 50% which will reduce the image to 50 percent of the original dimension. You must use the same value on both height and width attributes though. Smile
Thanks you two, +rep Big Grin
You're welcome =)