mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 06:27:59 +01:00
Server should now check local avatar file instead of URL
This commit is contained in:
parent
1c40d3cfa5
commit
b356cfaea1
2 changed files with 21 additions and 12 deletions
|
@ -172,18 +172,8 @@ class ArtistsController extends ApiControllerBase
|
|||
];
|
||||
}
|
||||
|
||||
$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
|
||||
}
|
||||
$palette = ColorThief::getPalette($user->getAvatarUrlLocal(Image::SMALL), 2);
|
||||
$formatted_palette = array_map("Helpers::rgb2hex", $palette);
|
||||
|
||||
$followers = Follower::where('artist_id', $user->id)
|
||||
->count();
|
||||
|
|
|
@ -273,6 +273,25 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||
return Gravatar::getUrl($email, Image::$ImageTypes[$type]['width']);
|
||||
}
|
||||
|
||||
public function getAvatarUrlLocal($type = Image::NORMAL)
|
||||
{
|
||||
if (!$this->uses_gravatar && $this->avatar !== null) {
|
||||
return $this->avatar->getFile($type);
|
||||
}
|
||||
|
||||
if ($this->email == "redacted@example.net") {
|
||||
return Gravatar::getUrl($this->id."", Image::$ImageTypes[$type]['width'], "identicon");
|
||||
}
|
||||
|
||||
$email = $this->gravatar;
|
||||
|
||||
if (!strlen($email)) {
|
||||
$email = $this->email;
|
||||
}
|
||||
|
||||
return Gravatar::getUrl($email, Image::$ImageTypes[$type]['width']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the token value for the "remember me" session.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue