[COMPONENTS][Avatar] Make sure dimension values are integers

[CARDS][Note] Fix assumed avatar dimension values
This commit is contained in:
Eliseu Amaro 2021-12-26 22:04:55 +00:00
parent 65a3d738ca
commit 19975b8d8d
Signed by: eliseuamaro
GPG Key ID: 96DA09D4B97BC2D5
1 changed files with 2 additions and 3 deletions

View File

@ -116,9 +116,8 @@ class Avatar extends Component
public static function getDimensions(int $actor_id, string $size = 'medium')
{
try {
$avatar = self::getAvatar($actor_id);
$a = $size === 'full' ? $avatar->getAttachment() : $avatar->getAttachmentThumbnail($size);
return ['width' => $a->getWidth(), 'height' => $a->getHeight()];
$attachment = self::getAvatar($actor_id)->getAttachment();
return ['width' => (int) $attachment->getWidth(), 'height' => (int) $attachment->getHeight()];
} catch (NoAvatarException) {
return ['width' => Common::config('thumbnail', 'small'), 'height' => Common::config('thumbnail', 'small')];
}