Configuration
Every option of the Media module, the image size presets, and the upload refusals they produce.
Every option is optional. The options live in the module's config in antelope.config.ts.
"dms-media": {
source: { type: "package", package: "@antelopejs/dms-media", version: "^0.9.3" },
config: {
storage: "media",
rootAcl: [{ subject: { kind: "permission", id: "articles.page" }, rights: ["read"] }],
allowedMimetypes: ["image/*", "application/pdf"],
storageQuotaBytes: 10_000_000_000,
publicBaseUrl: "${@api.API_PUBLIC_BASE_URL}",
presets: [
{ id: "thumb", width: 300, height: 300, fit: "cover", format: "webp", quality: 80 },
],
},
},
Options
| Option | Type | Default | Description |
|---|---|---|---|
storage | string | default storage | Named interface-file-storage backend. |
rootAcl | AclEntry[] | [] | Rights that the top-level folders inherit, and every folder below them that has no ACL of its own. Owners hold every right anyway, and members reach only the linked folders of their pages. An entry here opens the whole library to its subject. |
allowedMimetypes | string[] | images, video, audio, PDF, Office, OpenDocument, RTF, plain text, Markdown, CSV | File types the library accepts. A trailing * matches a prefix, as in image/*. The library always refuses HTML, XHTML and PHP, by type or by extension. |
storageQuotaBytes | number | none | Storage plan of the library. The overview measures usage against it, and presign and confirm refuse an upload that would go past it. |
publicBaseUrl | string | DMS apiBaseUrl | Public URL of the API, the origin that serves /media/.... Copied links and the Delivery tab start with it. With neither value set, links stay relative. The module never reads request headers for it. The dashboard's origin serves /media/... too, because the module declares /media/** to the frontend server, which forwards it with the member's session. |
privateLinkSeconds | number | 300 | Lifetime, in seconds, of the signed URL that a private file's /media/... link and its download hand out. The link gives the same URL for half of it, so a URL handed out stays valid for at least that half. |
presets | MediaPresetConfig[] | thumb, preview | Named image sizes. A list here replaces the defaults. Keep a thumb preset, because the explorer uses it for grid thumbnails. |
An AclEntry is { subject: { kind: "permission" | "role", id }, rights: ("read" | "write" | "manage")[] }. A right includes the weaker ones. manage includes write, and write includes read.
Image size presets
| Field | Type | Default | Description |
|---|---|---|---|
id | string | required | Name used in URLs, /media/<assetId>/<presetId>/<filename>. |
width, height | number | none | Target box, in pixels. Either one can be left out. With both left out, the image keeps its size. |
fit | "cover" | "contain" | "inside" | "cover" | How the image fits the box. The module never upscales an image. |
format | "webp" | "jpeg" | "png" | "avif" | source format | Output format. Without one, an image keeps its format, and an SVG renders as PNG. |
quality | number | encoder default | Encoder quality. It applies only with a format. |
The defaults are thumb (300 × 300, cover, WebP 80) and preview (1600 wide, inside, WebP 82). A changed preset gets a new cache key, so the next request renders it again. The daily sweep deletes the renderings of the old settings.
Upload refusals
A refused upload answers { reason, message }, and the upload queue explains the reason in the member's language. presign and confirm both run the type and quota checks. ImportMediaAsset runs every check below too, and rejects with an error that carries the refusal's message.
| Reason | Status | Cause |
|---|---|---|
type_not_allowed | 415 | The type is not in allowedMimetypes, or the file is HTML, XHTML or PHP. |
field_type | 415 | The linked folder feeds a field that accepts fewer types. The answer lists them in accepted. |
quota | 413 | The upload would go past storageQuotaBytes. The answer gives remaining and quota. |
invalid_image | 422 | On confirm, a file declared as a JPEG, PNG, WebP, GIF, AVIF or TIFF image does not decode. The module deletes the staged file. The module does not decode an image over 32 MiB and stores it without its width and height. |
Scheduled jobs
| Job | When | What |
|---|---|---|
dms-media-purge-staging | Every hour, at minute 30 | Deletes uploads staged more than 24 hours ago and never confirmed. |
dms-media-sweep-derivatives | Every day, at 04:00 server time | Removes the renderings of presets that changed, and deletes library events (media_events) older than 90 days. |