The media library
Upload images, PDFs, videos and captions to Admin → Media once and use them anywhere. Images come in every size a screen needs, alt text is written once, and replacing a file updates every page that shows it.
Updated · 6 min read
Admin → Media keeps your site's own files: images, PDFs, videos and their captions. Upload a file once and use it on any page, answer or form. Each image is made in several sizes, so phones and laptops each load the one they need, and replacing a file changes it everywhere it's used, at the same address.
Upload files
Drop files anywhere on Admin → Media, or choose Upload. Each file shows straight away as a tile with its progress, then "Making sizes…" while images are resized. A file that's refused says why, with Retry and a button to dismiss it.
| Kind | Types | Largest file |
|---|---|---|
| Images | JPEG, PNG, WebP, AVIF, GIF, SVG | 20 MB |
| Documents | 25 MB | |
| Videos | MP4, WebM | 100 MB |
| Audio | MP3, M4A | 100 MB |
| Captions | WebVTT (.vtt) | 1 MB |
| Fonts | WOFF2, WOFF, TrueType, OpenType, for your site's styles | 5 MB |
A file is judged by what's in it, not by its name. Anything else, like a HEIC photo, a WAV recording or a ZIP or Office file, is refused with what to upload instead. An SRT captions file is refused with a note to export WebVTT. An SVG that could run code or load other files is refused rather than cleaned up, and a captions file a browser couldn't show is refused with the line that's wrong.
Find files with the search (it matches names and alt text), the All, Images, Videos, Documents, Captions, Fonts and Audio filters (each shows once there's a file of that kind), and folders. Switch between a grid and a list at the top.
Audio is for podcast episodes (see The newsletter). It has no public address of its own: it plays on the episode's page and in podcast apps, only for the listeners the episode is for.
Use a file on a page
In the page editor, every image field (the Image layer, section images and backgrounds) has Upload and Library beside it. Library opens a picker with search, upload and your images. You can also drop an image file straight onto the canvas: it uploads and lands as an Image layer where you dropped it, in the file's shape and never wider than the file.
A Video block plays library videos too; see Videos, maps, tabs and slideshows. The site's share image in Admin → Site settings has Choose from library.
What visitors get
Every image is saved as WebP at 320, 640, 960, 1280 and 1920 pixels wide, up to its own width and never enlarged. The page offers them all, and each browser loads the smallest that fills the space. The page keeps the image's space while it loads, so nothing jumps, and images without transparency show a blurred preview until they arrive. An animated GIF or WebP becomes one animated WebP, every frame kept.
The WebP copies carry no camera or location data. The original JPEG, PNG, WebP, AVIF or GIF you uploaded is never public: only admins can download it.
Alt text and the focal point
Select a file to open its details. Alt text says what the image shows, for people who can't see it. Write it once and every page that shows the image uses it, unless a block sets its own. Missing alt text at the top lists the images that still need it.
To keep the subject in view when a layout crops the image, click it in the preview, or focus the preview and use the arrow keys. Centre puts the focal point back in the middle.
A connected agent can do the alt text for you: list_media finds images without it, and set_media_alt saves what the agent writes. Like every tool that writes, it's off until you turn it on in Admin → Agents. See Agents and the API.
Videos
A video's details also have a Description, its name for screen readers and in search results unless a block names it, and Plays with:
- Poster: the still shown before it plays. One is made from a frame about a second in when you upload. To use another frame, pause the preview on it and choose Use this frame, or pick or upload an image.
- Captions: a WebVTT file shown over the video.
- Other format: the same video as WebM beside an MP4, or the other way round. Browsers play the smaller one they can.
Each of these is a library file of its own, with its own details. Videos play from your own storage, with no other company involved. If your browser can't read a video's frames, the panel says so; choose an image for the poster instead.
Replace or delete a file
Replace file swaps in a new file of the same kind at the same address, so every page shows the new one straight away. The old file is removed 10 minutes later, so pages already open keep working.
Used on lists everywhere a file appears: pages and their translations, answers, downloads, forms, authors, site settings, these docs, the video it's the poster or captions for, and agents' edits waiting for approval. Each one links to where you'd change it. Delete file is only offered when nothing uses the file; until then, take it off those places first. Deleting can't be undone, and the file's address stops working.
Set up storage
On your own machine, files are kept on the server's disk with nothing to set up. A deployed server's disk is replaced on every deploy, so in production the library needs somewhere lasting: an S3-compatible bucket (a Railway Bucket, Amazon S3, Cloudflare R2 or MinIO) or a folder on a persistent volume.
Until one is set, Admin → Media says "Media storage needs setting up" and shows what to set, uploads and replacements are off, and Admin → Setup lists Media storage as still to do. The site keeps working meanwhile, and files you already have still show.
In a bucket
Set these on the server for any S3-compatible bucket. Once S3_BUCKET is set with its endpoint and both keys, uploads go to the bucket instead of the disk.
| Setting | What it is | Unset |
|---|---|---|
S3_BUCKET | The bucket's name | Files stay on the disk |
S3_ENDPOINT | The provider's S3 address, such as https://t3.storageapi.dev for a Railway Bucket | Needed with S3_BUCKET |
S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY | The bucket's key pair | Needed with S3_BUCKET |
S3_REGION | The bucket's region | auto |
S3_URL_STYLE | How the server addresses files: virtual puts the bucket in the host name (https://<bucket>.<endpoint host>/<file>), path puts it in the path (<endpoint>/<bucket>/<file>), which MinIO and some other providers need. virtual-host and virtual-hosted are read as virtual | virtual |
S3_FORCE_PATH_STYLE | true does the same as S3_URL_STYLE=path, for providers whose guides name it that way | false |
S3_PUBLIC_URL | The bucket's public address or CDN, if it has one | Every file comes through your site at /media/... |
S3_BUCKET without the endpoint or a key doesn't stop the server. Uploads are refused instead, and Admin → Media names the settings still missing.
With S3_PUBLIC_URL set, pages load the WebP sizes and videos straight from that address. SVGs, PDFs and private files still come through /media/..., with headers that stop an SVG or PDF from running anything. Leave it unset for a private bucket, such as a Railway Bucket: files are then served through your site, and browsers keep each version of a file for a year. deploy/RAILWAY.md walks through creating a Railway Bucket and pointing the server at it.
In a folder
MEDIA_DIR is the folder uploads are kept in when no bucket is set: .data/media under the server's working folder by default, so on your own machine there's nothing to set. In production, uploads go to a folder only once MEDIA_DIR names one. Point it at a persistent volume mounted on the server; a folder anywhere else is lost on the next deploy. The Docker Compose deploy sets it to /workspace/.data/media, on a volume of its own.
Good to know
- Admins upload, change and delete files. Viewers can look through the library but can't change anything or download originals.
- Uploads, changes, replacements and deletions are recorded in Admin → Audit, with the file's name, type and size, never the file itself.
- PDFs, SVGs and videos are served as you uploaded them, so they keep any data inside them, such as a PDF's author or the place a phone video was shot. Remove it before uploading if that matters.
- Images can be up to 100 million pixels.
- Files people send with a form aren't public: they open from the form's inbox for admins only. See Forms.
Something unclear or missing? Ask us and we'll answer, then fix the page.



