MyBB Community Forums
{avatar} stretching avatars - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Themes (https://community.mybb.com/forum-103.html)
+---- Forum: Theme Support (https://community.mybb.com/forum-10.html)
+---- Thread: {avatar} stretching avatars (/thread-95745.html)



{avatar} stretching avatars - xomp - 2011-06-04

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 />



RE: {avatar} stretching avatars - Yaldaram - 2011-06-04

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


RE: {avatar} stretching avatars - faviouz - 2011-06-04

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


RE: {avatar} stretching avatars - xomp - 2011-06-04

Thanks you two, +rep Big Grin


RE: {avatar} stretching avatars - Yaldaram - 2011-06-04

You're welcome =)