Add image uploads with a media library, and event card backgrounds

Uploads (migration 028, server/src/media.js, routes/media.js): editors
and up upload JPEG, PNG, GIF, WebP or SVG. Photos are resized to 2400px
and saved as WebP by default, or kept as uploaded on request. Files
live in UPLOADS_DIR, served by nginx in production and by the API in
dev. Admins and up delete, after seeing what still uses the file.

Every image field in the editor is now an image widget: preview, the
path as text, Upload and Choose from library. A new Media page lists
the library. Org lists and event cards now resolve logos through
media.ts, so uploaded paths work there.

Events get a card_image (migration 029): a photo behind the card under
a light veil so the text stays readable. The card's size is unchanged.

Setup for production is in docs/media-uploads.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 15:04:45 -05:00
parent cd393e4ab2
commit eaff23839f
26 changed files with 1234 additions and 22 deletions

View file

@ -17,6 +17,10 @@
const ABSOLUTE = /^(https?:|\/|data:)/
/* An uploaded file ('/uploads/…'), a path anywhere on the site, or
a full URL: something to use as it is rather than resolve. */
export const isAbsoluteMedia = (file?: string | null) => Boolean(file && ABSOLUTE.test(file))
function inDir(dir: string) {
return (file?: string | null): string | null => {
if (!file) return null
@ -27,6 +31,7 @@ function inDir(dir: string) {
export const personPhoto = inDir('/people') // confirmed
export const eventLogo = inDir('/event-logos') // confirmed
export const eventBackground = inDir('/event-backgrounds')
export const orgLogo = inDir('/org-logos') // ⚠ guess
export const teamLogo = inDir('/team-logos') // ⚠ guess
export const awardLogo = inDir('/award-logos') // ⚠ guess