Files: read image width and height on upload and return them from the metadata routes
- Dominant language
- C#
- Stars
- 6
- Forks
- 7
- Avg merge
- 4h 42m
- Merged PRs (30d)
- 307
Description
Found while planning barakocms.com as a barakoCMS-backed site.
`StoredFile` and `FileMetadata` carry alt text and caption and nothing about pixel dimensions. `GET /api/files/{id}/meta` and the public equivalent return no width and no height.
## Why this matters
A frontend has to put `width` and `height` on an `img` to reserve space, or the page shifts as images load. That is a Core Web Vital, and it is the one thing a CMS is best placed to answer, because it has the bytes at upload time.
Without it every consumer downloads the file and reads the header itself, at build or at request time, to recover a number the CMS already had and threw away.
## What to change
Read width and height when an image is uploaded, store them on `StoredFile`, and return them from `/meta` and `/public/files/{id}/meta`. Variants (`docs/image-variants.md`) should report their own dimensions, not the original's.
Contributor guide
Research direction
Start by tracing the upload handling for StoredFile and the implementations of GET /api/files/{id}/meta and /public/files/{id}/meta, then read docs/image-variants.md. Confirm how FileMetadata is populated and how variants are represented. Done means uploaded images retain their width and height, both metadata routes return them, and variants report their own dimensions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 57/100