mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Use other default avatar, not in the avatars directory
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
c4e7448d31
commit
8fc5c0b5be
|
@ -452,7 +452,6 @@ class SettingsController extends Controller
|
|||
}
|
||||
|
||||
if ($request->input('restore_default_avatar') == '1') {
|
||||
Setting::restoreDefaultAvatar();
|
||||
$setting->default_avatar = 'default.png';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -445,26 +445,30 @@ class UserPresenter extends Presenter
|
|||
return Storage::disk('public')->url('avatars/'.e($this->avatar));
|
||||
}
|
||||
|
||||
// If there is a default avatar
|
||||
if (Setting::getSettings()->default_avatar!= '') {
|
||||
|
||||
// If the default is system default
|
||||
if (Setting::getSettings()->default_avatar == 'default.png') {
|
||||
return Storage::disk('public')->url('default.png');
|
||||
}
|
||||
|
||||
// If there is a custom default avatar
|
||||
if (Setting::getSettings()->default_avatar != '') {
|
||||
return Storage::disk('public')->url('avatars/'.e(Setting::getSettings()->default_avatar));
|
||||
}
|
||||
|
||||
// Fall back to Gravatar if the settings allow loading remote scripts
|
||||
if (Setting::getSettings()->load_remote == '1') {
|
||||
if ($this->model->gravatar != '') {
|
||||
// If there is no default and no custom avatar, check for gravatar
|
||||
if ((Setting::getSettings()->load_remote == '1') && (Setting::getSettings()->default_avatar == '')) {
|
||||
|
||||
if ($this->model->gravatar != '') {
|
||||
$gravatar = md5(strtolower(trim($this->model->gravatar)));
|
||||
return '//gravatar.com/avatar/'.$gravatar;
|
||||
|
||||
} elseif ($this->email != '') {
|
||||
|
||||
$gravatar = md5(strtolower(trim($this->email)));
|
||||
return '//gravatar.com/avatar/'.$gravatar;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Loading…
Reference in a new issue