CoolCMS API

AssetProcessingResult
in package

FinalYes

Output of {@see AssetFormatProcessor}: what the processor left on disk.

The processor deliberately does not return an Asset entity: assembly and persistence are shared by all formats and stay in one place (AssetProcessingTrait::saveAssetVariants()), so that Asset columns are not filled in its own way by each format.

Table of Contents

Properties

$rejected  : bool
$rejectionCode  : string|null
$rejectionReason  : string|null
$thumbnailExtension  : string|null
$thumbnailsGenerated  : bool
$variantDims  : array<string|int, mixed>

Methods

getRejectionCode()  : string|null
Reason code for the user message ({@see UploadRejection} `REASON_*`); `null` on success.
getRejectionReason()  : string|null
getThumbnailExtension()  : string|null
getVariantDims()  : array<string, array{width: int, height: int}>
isRejected()  : bool
isThumbnailsGenerated()  : bool
rejected()  : self
The file could not be processed (corrupt image, SVG that failed sanitization, ...).
success()  : self
__construct()  : mixed

Properties

Methods

getRejectionCode()

Reason code for the user message ({@see UploadRejection} `REASON_*`); `null` on success.

public getRejectionCode() : string|null

getRejectionReason() is the log text.

Return values
string|null

getThumbnailExtension()

public getThumbnailExtension() : string|null
Return values
string|null

getVariantDims()

public getVariantDims() : array<string, array{width: int, height: int}>
Return values
array<string, array{width: int, height: int}>

rejected()

The file could not be processed (corrupt image, SVG that failed sanitization, ...).

public static rejected(string $reason[, string $code = UploadRejection::REASON_UNREADABLE ]) : self

$code is the code for the user message (UploadRejection), $reason is the log text. The caller does not create an Asset at all; such input would otherwise abort the whole flush with a GD exception.

Parameters
$reason : string
$code : string = UploadRejection::REASON_UNREADABLE
Return values
self

success()

public static success(string|null $thumbnailExtension, bool $thumbnailsGenerated, array<string, array{width: int, height: int}> $variantDims) : self
Parameters
$thumbnailExtension : string|null

extension of the generated variants on disk; null = variants not created yet (video without ffmpeg, the catch-up cron fills them in)

$thumbnailsGenerated : bool
$variantDims : array<string, array{width: int, height: int}>

real dimensions per variant, stored in Asset.meta

Return values
self

__construct()

private __construct(bool $rejected, string|null $rejectionReason, string|null $thumbnailExtension, bool $thumbnailsGenerated, array<string, array{width: int, height: int}> $variantDims[, string|null $rejectionCode = null ]) : mixed
Parameters
$rejected : bool
$rejectionReason : string|null
$thumbnailExtension : string|null
$thumbnailsGenerated : bool
$variantDims : array<string, array{width: int, height: int}>
$rejectionCode : string|null = null
On this page

Search results