Merge pull request #709 from robintown/crisp-avatars

Fix blurry avatars
This commit is contained in:
Robin 2022-11-03 14:01:04 -04:00 committed by GitHub
commit 1e02afe1c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -309,5 +309,7 @@ export function getAvatarUrl(
): string {
const width = Math.floor(avatarSize * window.devicePixelRatio);
const height = Math.floor(avatarSize * window.devicePixelRatio);
return mxcUrl && client.mxcUrlToHttp(mxcUrl, width, height, "crop");
// scale is more suitable for larger sizes
const resizeMethod = avatarSize <= 96 ? "crop" : "scale";
return mxcUrl && client.mxcUrlToHttp(mxcUrl, width, height, resizeMethod)!;
}