mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Fix remote avatar urls when not using cloud storage
This commit is contained in:
parent
012032a20e
commit
672f7c8ce0
1 changed files with 7 additions and 3 deletions
|
@ -157,15 +157,19 @@ class Profile extends Model
|
||||||
|
|
||||||
public function avatarUrl()
|
public function avatarUrl()
|
||||||
{
|
{
|
||||||
$url = Cache::remember('avatar:'.$this->id, now()->addYears(1), function () {
|
$url = Cache::remember('avatar:'.$this->id, 1209600, function () {
|
||||||
$avatar = $this->avatar;
|
$avatar = $this->avatar;
|
||||||
|
|
||||||
if($avatar->cdn_url) {
|
if($avatar->cdn_url) {
|
||||||
return $avatar->cdn_url ?? url('/storage/avatars/default.jpg');
|
if(substr($avatar->cdn_url, 0, 8) === 'https://') {
|
||||||
|
return $avatar->cdn_url;
|
||||||
|
} else {
|
||||||
|
return url($avatar->cdn_url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($avatar->is_remote) {
|
if($avatar->is_remote) {
|
||||||
return $avatar->cdn_url ?? url('/storage/avatars/default.jpg');
|
return url('/storage/avatars/default.jpg');
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $avatar->media_path;
|
$path = $avatar->media_path;
|
||||||
|
|
Loading…
Reference in a new issue