CoolCMS API

VectorImageProcessor
in package
implements AssetFormatProcessor

FinalYes

SVG: stored sanitized and otherwise unchanged in every variant.

No resize, watermark or conversion: a vector scales in the browser, so variants differ only by path, not by content. They must still be copied: the variant plan is always stored in Asset.variants and templates build URLs from it (thumb/<name>.svg), so the file has to exist there.

Sanitization (SvgSanitizer) is part of processing, not an optional extra; when the file fails it, no Asset is created.

Table of Contents

Interfaces

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

Properties

$svgSanitizer  : SvgSanitizer
$variantRenderer  : VariantRenderer

Methods

__construct()  : mixed
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

Properties

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