Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/constants/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export const AVATAR_MAX_PX = 256;
screen, and a 64px source is soft at the top of that. */
export const AVATAR_THUMB_PX = 128;

/** The member card banner, 5:2. A 320px hover card at 3x is 960 across. */
export const BANNER_BOX = { width: 960, height: 384, thumbWidth: 480, thumbHeight: 192 } as const;
/** The member card's banner is 320 by 164 CSS px, so 3x of that. Any other shape and the card
crops and scales the stored picture again, so it stops matching what the editor showed. */
export const BANNER_BOX = { width: 960, height: 492, thumbWidth: 480, thumbHeight: 246 } as const;
5 changes: 3 additions & 2 deletions src/routes/bannerUpload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { after, before, describe, it } from "node:test";
import express from "express";
import sharp from "sharp";

import { BANNER_BOX } from "../constants/media";
import { initSqlite } from "../db/sqlite/connection";
import { getFile } from "../db/sqlite/messages";
import { createRoleDefinition } from "../db/sqlite/roleDefinitions";
Expand Down Expand Up @@ -100,8 +101,8 @@ describe("POST /api/uploads/banner", () => {

const file = await getFile(fileId);
assert.equal(file?.mime, "image/avif");
assert.equal(file?.width, 960);
assert.equal(file?.height, 384);
assert.equal(file?.width, BANNER_BOX.width);
assert.equal(file?.height, BANNER_BOX.height);
assert.ok(file?.s3_key.startsWith("banners/"));
});

Expand Down
Loading