CoolCMS API

AssetFormatProcessor

Processes one format of an uploaded file: receives the bytes and the variant plan, writes files to disk and reports what was created.

A new format means a new implementation plus a row in config/Shared/assetVariants.neon; nothing else changes. The registry (AssetFormatRegistry) collects extensions and MIME types from the processors itself.

IMPORTANT: an implementation must not create an Asset entity or touch the DB, only the filesystem.

Table of Contents

Methods

getExtensions()  : array<int, string>
Extensions (lowercase, without the dot) handled by the processor. They must be disjoint across processors; the registry reports a configuration error on a collision.
getKind()  : AssetFormatKind
getMimeTypes()  : array<int, string>
MIME types matching {@see getExtensions()}; the uploaders build their `accept` attributes from them so that client and server stay in agreement.
process()  : AssetProcessingResult

Methods

getExtensions()

Extensions (lowercase, without the dot) handled by the processor. They must be disjoint across processors; the registry reports a configuration error on a collision.

public getExtensions() : array<int, string>
Return values
array<int, string>

getMimeTypes()

MIME types matching {@see getExtensions()}; the uploaders build their `accept` attributes from them so that client and server stay in agreement.

public getMimeTypes() : array<int, string>
Return values
array<int, string>
On this page

Search results