mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 06:27:59 +01:00
Fixed server crashing if avatar can't be found
This commit is contained in:
parent
68a690277e
commit
1c40d3cfa5
1 changed files with 12 additions and 2 deletions
|
@ -172,8 +172,18 @@ class ArtistsController extends ApiControllerBase
|
|||
];
|
||||
}
|
||||
|
||||
$palette = ColorThief::getPalette($user->getAvatarUrl(Image::SMALL), 2);
|
||||
$formatted_palette = array_map("Helpers::rgb2hex", $palette);
|
||||
$formatted_palette = [
|
||||
"#ffffff",
|
||||
"#ffffff",
|
||||
"#ffffff"
|
||||
];
|
||||
|
||||
try {
|
||||
$palette = ColorThief::getPalette($user->getAvatarUrl(Image::SMALL), 2);
|
||||
$formatted_palette = array_map("Helpers::rgb2hex", $palette);
|
||||
} catch (Exception $e) {
|
||||
// We failed to get the image, oh well
|
||||
}
|
||||
|
||||
$followers = Follower::where('artist_id', $user->id)
|
||||
->count();
|
||||
|
|
Loading…
Reference in a new issue