MyBB Community Forums

Full Version: Automatically scale down avatar in welcomeblock
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Anyone know how to enable MyBB's automatically scale down thingy for avatars (like it does in posts) but for my welcomeblock avatar?

http://i.imgur.com/MlT7v.jpg

I would like for it to scale correctly like it does in forum posts if possible. Thanks!

Link to my forums here.
use this code in ur welcome block member template.

Just find :

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

Add this

width="50" height="50"

So it looks like
<img src="{$mybb->user['avatar']}" alt="" / width="50" height="50" >




@envira: the problem is that it will not resize proportional by using both width and height. You can better only set the height to the maximum height you want it to be. The browser will calculate the image width automatically to resize proportional.
<img src="{$mybb->user['avatar']}" alt="" style="height: 50px" />
Or can you use percentages, and use the same value in both width and height attributes. For example:

<img src="{$mybb->user['avatar']}" alt="" width="50%" height="50%" />
(2011-06-13, 11:12 AM)faviouz Wrote: [ -> ]Or can you use percentages, and use the same value in both width and height attributes. For example:

<img src="{$mybb->user['avatar']}" alt="" width="50%" height="50%" />

This actually worked out a tad better, but has put the avatar behind the welcome block.

http://i.imgur.com/4wwbx.jpg

If it helps at all here is my header templates code where I have all this in.

<div id="container">
<head>
	<link rel="stylesheet" href="/menu/menu_style.css" type="text/css" />
</head>

<ul id="menu">
   <li><a href="http://www.xomby.org/" target="_self">Home</a></li>
   <li><a href="http://www.xomby.org/memberlist.php" target="_self">Members</a></li>
   <li><a href="http://www.xomby.org/search.php" target="_self">Search</a></li>
   <li><a href="http://www.xomby.org/misc.php?page=irc" target="_self">IRC Chat</a></li>
   <li><a href="http://steamcommunity.com/groups/xomby" target="_self">Steam Group</a></li>

</ul></div>
<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="userbox_panel">{$welcomeblock}</div>
            <div id="userbox"><a href="{$mybb->settings['bburl']}/usercp.php"><img src="{$mybb->user['avatar']}" alt="" width="50%" height="50%" /></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 />
Test account please? So I can upload an avatar and play with the code live...
(2011-06-13, 02:46 PM)faviouz Wrote: [ -> ]Test account please? So I can upload an avatar and play with the code live...

Cheers faviouz! I've sent you a PM with the test account info.
The code isn't being used at the moment, can you make the edit please?
(2011-06-13, 03:09 PM)faviouz Wrote: [ -> ]The code isn't being used at the moment, can you make the edit please?

Sure thing! I've updated it now.
hmm, you know, this might not be the best solution. While Firefox (the browser you're using) interprets that 50% width and height is supposed to be half of the original size, other browsers don't. I tried three different browsers, and they all interpreted this markup in a different manner.

So I think it's best if we use Aries-Belgium's solution, which I believe to work the same under most browsers. Change the 50px value to one that you like, and then we'll fix the avatar going under the welcomeblock thing.
Pages: 1 2