src/Service/Cdn.php
public function urlAvatar($iUserId = null, $iWidth = 100, $iHeight = 100)
    {
        if (is_null($iUserId)) {
            $iUserId = activeUser('id');
        }

        if (empty($iUserId)) {
            $avatarUrl = $this->urlBlankAvatar($iWidth, $iHeight);
        } else {
            $oUserModel = Factory::model('User', 'nails/module-auth');
            $user       = $oUserModel->getById($iUserId);
            if (empty($user)) {
                $avatarUrl = $this->urlBlankAvatar($iWidth, $iHeight);
            } elseif (empty($user->profile_img)) {
                $avatarUrl = $this->urlBlankAvatar($iWidth, $iHeight, $user->gender);
            } else {
                $avatarUrl = $this->urlCrop($user->profile_img, $iWidth, $iHeight);
            }
        }

        return $avatarUrl;
    }
public function urlAvatar($iUserId = null, $iWidth = 100, $iHeight = 100)
    {
        if (is_null($iUserId)) {
            $iUserId = activeUser('id');
        }

        if (empty($iUserId)) {
            $avatarUrl = $this->urlBlankAvatar($iWidth, $iHeight);
        } else {
            $oUserModel = Factory::model('User', 'nails/module-auth');
            $user       = $oUserModel->getById($iUserId);
            if (empty($user)) {
                $avatarUrl = $this->urlBlankAvatar($iWidth, $iHeight);
            } elseif (empty($user->profile_img)) {
                $avatarUrl = $this->urlBlankAvatar($iWidth, $iHeight, $user->gender);
            } else {
                $avatarUrl = $this->urlCrop($user->profile_img, $iWidth, $iHeight);
            }
        }

        return $avatarUrl;
    }
public function urlAvatar ( $ iUserId = null , $ iWidth = 100 , $ iHeight = 100 ) { if ( is_null ( $ iUserId ) ) { $ iUserId = activeUser ( 'id' ) ; } if ( empty ( $ iUserId ) ) { $ avatarUrl = $ this -> urlBlankAvatar ( $ iWidth , $ iHeight ) ; } else { $ oUserModel = Factory :: model ( 'User' , 'nails/module-auth' ) ; $ user = $ oUserModel -> getById ( $ iUserId ) ; if ( empty ( $ user ) ) { $ avatarUrl = $ this -> urlBlankAvatar ( $ iWidth , $ iHeight ) ; } elseif ( empty ( $ user -> profile_img ) ) { $ avatarUrl = $ this -> urlBlankAvatar ( $ iWidth , $ iHeight , $ user -> gender ) ; } else { $ avatarUrl = $ this -> urlCrop ( $ user -> profile_img , $ iWidth , $ iHeight ) ; } } return $ avatarUrl ; }
Returns the appropriate avatar for a user

@param int $iUserId The user's ID
@param int $iWidth  The width of the avatar
@param int $iHeight The height of the avatar

@return  string
Returns the appropriate avatar for a user