thyseus / yii-user-management

a user management module collection for the yii framework
186 stars 122 forks source link

Avatar display in a wrong size #179

Open itdap opened 10 years ago

itdap commented 10 years ago

I found on the /user/models/YumUser.php file in the following function an extra space that will cause the image size problem.(avatarThumbnailWidth . ' px;'); & avatarDisplayWidth . 'px;'); this is the correct function:

    public function getAvatar($thumb = false)
    {
            if (Yum::hasModule('avatar') && $this->profile) {
                    $options = array();
                    if ($thumb)
                            $options = array('class' => 'avatar', 'style' => 'width: ' . Yum::module('avatar')->avatarThumbnailWidth . 'px;');
                    else
                            $options = array('class' => 'avatar', 'style' => 'width: ' . Yum::module('avatar')->avatarDisplayWidth . 'px;');

                    $return = '<div class="avatar">';

                    if(Yum::module('avatar')->enableGravatar && $this->avatar == 'gravatar')
                            return CHtml::image(
                                            'http://www.gravatar.com/avatar/'. $this->getGravatarHash(),
                                            Yum::t('Avatar image'),
                                            $options);

                    if (isset($this->avatar) && $this->avatar)
                            $return .= CHtml::image(Yii::app()->baseUrl . '/'
                                            . $this->avatar, 'Avatar', $options);
                    else
                            $return .= CHtml::image(Yii::app()->getAssetManager()->publish(
                                                    Yii::getPathOfAlias('YumAssets.images') . ($thumb
                                                            ? '/no_avatar_available_thumb.jpg' : '/no_avatar_available.jpg'),
                                                    Yum::t('No image available'),
                                                    $options));
                    $return .= '</div><!-- avatar -->';
                    return $return;
            }
    }

}

bouiboui commented 10 years ago

I guess it has been corrected, I tried to find the error and couldn't. (close the issue, maybe?)