public static $avatarPath = '@app/public_html/upload/images/avatar';
public static $avatarUrl = '/upload/images/avatar';
public static $noAvatar = '/upload/images/avatar/noavatar.png';
public function init()
{
parent::init();
// custom initialization code goes here
}
public static function getAvatar($avatar)
{
if(file_exists(self::$avatarPath . '/' . $avatar))
{
return yii\helpers\Html::img(self::$avatarPath . '/' . $avatar));
}
else
{
return yii\helpers\Html::img(self::$avatarPath . '/' . self::$noAvatar));
}
}