Seite 1 von 1

resize remote avatar mod umschreiben?

Verfasst: 17.07.2005 18:09
von Shadowproject
kann mir jmd den resize remote avatar mod umschreiben damit die avatare in der memberlist (ava in memberlist mod) dort alle eine feste gr��e haben?

hier sind beide:

resize remote avatar:

Code: Alles auswählen

# 
#-----[ OPEN ]------------------------------------------ 
# 
viewtopic.php

# 
#-----[ FIND ]------------------------------------------ 
# 
                $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';

# 
#-----[ REPLACE WITH ]------------------------------------------ 
                // Resize Remote Avatars mod
                // $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
                // set these vars to your preference for viewtopic (these are only a suggestion)
                $max_width = 400;
                $max_height = 400;
                $poster_avatar = get_remote_img_tag( $postrow[$i]['user_avatar'], $max_width, $max_height );
                // end Resize Remote Avatars mod

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/functions.php

#
#-----[ FIND ]------------------------------------------ 
# 
?>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
// Start Resize Remote Avatars mod
function get_remote_img_tag( $url, $max_width, $max_height )
{
    global $lang;
    global $board_config;
    $tag = '';

    // @getimagesize returns false if the remote image is not found
    $size = @getimagesize( $url );

    if ( $size )
    {
        $width = $size[0];
        $height = $size[1];


        if ( $width > $max_width || $height > $max_height)
        {
            $tag = $lang['Avatar_too_large'];
        }
        // otherwise dynamically resize the avatar
        else
        {
            $width_attr = '';
            $height_attr = '';
            // resize the avatar in the browser if either dimension is too large
            $resize = $width > $board_config['avatar_max_width'] || $height > $board_config['avatar_max_height'];

            // set max dimension and adjust the other according to the ratio
            if ( $resize )
            {
                if ( $width == $height ) 
                {
                    $width_attr = ' width="' . $board_config['avatar_max_width'] . '"';
                    $height_attr = ' height="' . $board_config['avatar_max_height'] . '"';
                }
                else if ( $width > $height )
                {
                    $width_attr = ' width="' . $board_config['avatar_max_width'] . '"';
                    $height_attr = ' height="' . $board_config['avatar_max_width'] * $height / $width . '"';
                }
                else // $height > $width
                {
                    $width_attr = ' width="' . $board_config['avatar_max_height'] * $width / $height . '"';
                    $height_attr = ' height="' . $board_config['avatar_max_height'] . '"';
                }
            }
            $tag = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $url . '" alt="" border="0"' . $width_attr . $height_attr . '/>' : '';
        }
    }
    // if the image was not found, display a configurable message
    else
    {
        $tag = $lang['Avatar_not_found'];
    }
    return $tag;
}
// End Resize Remote Avatars mod

# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------ 
# 
?>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
// note: place whatever text you like here for the error tags, including an empty string ''
$lang['Avatar_not_found'] = '<Avatar not found>';
$lang['Avatar_too_large'] = '<Avatar too large>';


#-------------------------------------------------------------
# OPTIONAL: edit the next file *only* if you also wish to resize avatars on the profile page
#-------------------------------------------------------------

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/usercp_viewprofile.php (optional)

# 
#-----[ FIND ]------------------------------------------ 
# 
            $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
            // Resize Remote Avatars mod
            // $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
            // set these vars to your preference for viewprofile (these are only a suggestion)
            $max_width = 800;
            $max_height = 800;
            $avatar_img = get_remote_img_tag( $postrow[$i]['user_avatar'], $max_width, $max_height );
            // end Resize Remote Avatars mod


# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
avatar in memberlist:

Code: Alles auswählen

// Directions: -----------------------------------------

� Open /templates/themename/memberlist_body.tpl

Find: >>>
 <th class="thCornerR" nowrap="nowrap">{L_WEBSITE}</th>
After add: >>>
 <th class="thCornerR" nowrap="nowrap">Avatar</th>
 

Find: >>>
 <td class="{memberrow.ROW_CLASS}" align="center">&nbsp;{memberrow.WWW_IMG}&nbsp;</td>
After add: >>>
 <td class="{memberrow.ROW_CLASS}" align="center">&nbsp;{memberrow.AVATAR_IMG}&nbsp;</td>
 
 
Find: >>>
 <td class="catbottom" colspan="9"
NOTE: if u have installed other hacks that modify the memberlist, there could be different nunber (not 9)
Replace with: >>>
 <td class="catbottom" colspan="10"
 


� Open /memberlist.php

Find: >>>
 $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : '';
After add: >>>
 $avatar_img = ($row['user_avatar'] && $row['user_avatar_type']==2 ? '<img src=' . $row['user_avatar'] . '>' : ($row['user_avatar'] && $row['user_avatar_type']==3 ? '<img src=images/avatars/gallery/' . $row['user_avatar'] . '>' : false));
 
 
Find: >>>
 'WWW' => $www,
After add: >>>
 'AVATAR_IMG' => $avatar_img,