Skip to content

Commit

Permalink
fixed #88
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Nov 21, 2017
1 parent d2ed48a commit 5513044
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
12 changes: 7 additions & 5 deletions app/Models/Auth/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ public function getPictureAttribute($value)
{
// Check if we should use gravatar
if (setting('general.use_gravatar', '0') == '1') {
// Check for gravatar
$url = 'https://www.gravatar.com/avatar/' . md5(strtolower($this->getAttribute('email'))).'?size=90&d=404';
try {
// Check for gravatar
$url = 'https://www.gravatar.com/avatar/' . md5(strtolower($this->getAttribute('email'))).'?size=90&d=404';

$client = new \GuzzleHttp\Client(['verify' => false]);
$client = new \GuzzleHttp\Client(['verify' => false]);

try {
$value = $client->request('GET', $url)->getBody()->getContents();
$client->request('GET', $url)->getBody()->getContents();

$value = $url;
} catch (RequestException $e) {
// 404 Not Found
}
Expand Down
12 changes: 10 additions & 2 deletions resources/views/partials/admin/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
@if ($user->picture)
<img src="{{ Storage::url($user->picture) }}" class="user-image" alt="User Image">
@if (setting('general.use_gravatar', '0') == '1')
<img src="{{ $user->picture }}" class="user-image" alt="User Image">
@else
<img src="{{ Storage::url($user->picture) }}" class="user-image" alt="User Image">
@endif
@else
<i class="fa fa-user-o"></i>
@endif
Expand All @@ -168,7 +172,11 @@
<!-- User image -->
<li class="user-header">
@if ($user->picture)
<img src="{{ Storage::url($user->picture) }}" class="img-circle" alt="User Image">
@if (setting('general.use_gravatar', '0') == '1')
<img src="{{ $user->picture }}" class="img-circle" alt="User Image">
@else
<img src="{{ Storage::url($user->picture) }}" class="img-circle" alt="User Image">
@endif
@else
<i class="fa fa-4 fa-user-o" style="color: #fff; font-size: 7em;"></i>
@endif
Expand Down

0 comments on commit 5513044

Please sign in to comment.