diff --git a/app/User.php b/app/User.php index a746bd1c7..d6d573d21 100644 --- a/app/User.php +++ b/app/User.php @@ -44,13 +44,18 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon if ($info) { $pic = $this->checkArray('avatar', $info); } - if (!$pic) { - $pic = asset('uploads/profilepic/'.$value); + if (!$pic && $value) { + $pic = ""; + $file = public_path('uploads/profilepic/' . $value); + if ($file) { + $type = pathinfo($file, PATHINFO_EXTENSION); + $data = file_get_contents($file); + $pic = 'data:image/' . $type . ';base64,' . base64_encode($data); + } } if (!$value) { $pic = \Gravatar::src($this->attributes['email']); } - return $pic; }