Seite 1 von 1

Resize Remote Avatars mod-Frage

Verfasst: 28.03.2006 19:00
von Anonymer User
Habe den Resize Remote Avatars mod eingebaut und ich habe jetzt von einer Möglichkeit gelesen, dass die Bilder automatisch kleiner gemacht werden. Bei mir kommt jedoch nur der Text aus der lang_main, dass das Avatar zu groß ist. Kann jemans mir sagen wie ich die funktions.php anpassen muss damit es paßt?!

Code: Alles auswählen

// 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
mfg
A.U. 8)

Verfasst: 30.03.2006 02:19
von Anonymer User
hau-ruck

Auch wenn die Lösung einfach sein sollte - ich seh sie nicht :oops:

Verfasst: 31.03.2006 00:37
von Anonymer User
Ich schieb noch einmal, da ich heute nicht so lange wach bleibe wie gestern...