VectorImageProcessor
in package
implements
AssetFormatProcessor
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
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
$svgSanitizer read-only
private
SvgSanitizer
$svgSanitizer
$variantRenderer read-only
private
VariantRenderer
$variantRenderer
Methods
__construct()
public
__construct(SvgSanitizer $svgSanitizer, VariantRenderer $variantRenderer) : mixed
Parameters
- $svgSanitizer : SvgSanitizer
- $variantRenderer : VariantRenderer
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>getKind()
public
getKind() : AssetFormatKind
Return values
AssetFormatKindgetMimeTypes()
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>process()
public
process(AssetProcessingContext $context) : AssetProcessingResult
Parameters
- $context : AssetProcessingContext