resize avatr on welcome mod

Modifications for phpBB3.
Try the Mods here and share Your own Mods
Forum rules
You dont have to use ModX or make your mod AutoMod compatible. A simple textfile is fine
But if you post Mods here You also have to give support

resize avatr on welcome mod

Post by slash »

Hi guys! how can i resize avatar on welcome mod? i try to myselff but im fail! :oops:

resize avatr on welcome mod

Post by Rhiamon »

Open index.php

Find:

Code: Select all

'USER_AVATAR'               => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
Replace With:

Code: Select all

'SMALL_USER_AVATAR'   => ($user->data['user_avatar']) ? get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], ($user->data['user_avatar_width'] > $user->data['user_avatar_height']) ? 50 : (50 / $user->data['user_avatar_height']) * $user->data['user_avatar_width'], ($user->data['user_avatar_height'] > $user->data['user_avatar_width']) ? 50 : (50 / $user->data['user_avatar_width']) * $user->data['user_avatar_height']) : '', 
Avatar size is 50x50 px, change to your size !!

Open includes/functions.php

Find:

Code: Select all

?>
Before Add:

Code: Select all

function get_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'SMALL_USER_AVATAR')
{
    global $user, $config, $phpbb_root_path, $phpEx;

    if (empty($avatar) || !$avatar_type)
    {
        return '';
    }

    $avatar_img = '';

    switch ($avatar_type)
    {
        case AVATAR_UPLOAD:
            $avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar=";
        break;

        case AVATAR_GALLERY:
            $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
        break;
    }

    $avatar_img .= $avatar;
    return '<img src="' . $avatar_img . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
} 
Open styles/xxx/template/index_body.html

Find:

Code: Select all

<!-- IF USER_AVATAR -->{USER_AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF -->
Replace With:

Code: Select all

<!-- IF USER_AVATAR -->{SMALL_USER_AVATAR}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" alt="" /><!-- ENDIF -->

resize avatr on welcome mod

Post by slash »

thank you!