Skip to content

Commit d4f0b46

Browse files
committed
Increase avatar thumbnail resolution for HiDPI displays
1 parent de03f8e commit d4f0b46

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

functions/api/avatar-upload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const onRequestPost: PagesFunction<Env> = async ({ request, env }) => {
5858
const thumb = parseDataUrl(body.thumbDataUrl);
5959

6060
if (original.bytes.byteLength > 5_000_000) throw new Error("Avatar image too large.");
61-
if (thumb.bytes.byteLength > 300_000) throw new Error("Avatar thumbnail too large.");
61+
if (thumb.bytes.byteLength > 1_000_000) throw new Error("Avatar thumbnail too large.");
6262

6363
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", original.bytes));
6464
const hash = toHex(digest);

src/components/UserAdminPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const writeDismissedNotificationIds = (ids: Set<string>) => {
6565
const resizeAvatarFileToDataUrl = async (file: File): Promise<{ originalDataUrl: string; thumbDataUrl: string }> => {
6666
const bitmap = await createImageBitmap(file);
6767
const maxOriginal = 2048;
68-
const maxThumb = 72;
68+
const maxThumb = 320;
6969
const originalScale = Math.min(1, maxOriginal / Math.max(bitmap.width, bitmap.height));
7070
const thumbScale = Math.min(1, maxThumb / Math.max(bitmap.width, bitmap.height));
7171
const originalWidth = Math.max(1, Math.round(bitmap.width * originalScale));

0 commit comments

Comments
 (0)