ProcessedResource

final class \TYPO3\CMS\Core\Resource\ProcessedResource

Implements
ProcessedResourceInterface

Representation of a specific processed version of a resource that is not backed by the File Abstraction Layer - most commonly a system resource shipped with a package. This is the non-FAL counterpart to ProcessedFile: instances are created by ProcessedResourceCache, which also owns where a rendered variant physically lives - nothing outside that class ever reads this object's local path.

There is no database row backing this object: "does a current rendered variant already exist" is answered by ProcessedResourceCache checking the filesystem, the same way GraphicalFunctions::resize() already does for its own output, keyed by the original resource's identifier and content hash rather than an unstable absolute path/mtime pair.

Table of Contents

Interfaces

ProcessedResourceInterface
A resource that is the result of processing (resizing, cropping, converting, ...) another, original resource - implemented by both the FAL-backed ProcessedFile and, for resources outside the File Abstraction Layer, ProcessedResource.

Methods

__construct()  : mixed
__toString()  : string
delete()  : bool
exists()  : bool
getContents()  : string
getExtension()  : string
getHash()  : string
getImageDimension()  : ImageDimension
Dimensions a processor stored for this resource take precedence, as ProcessedFile does - e.g. an SVG which is reused as-is but rendered at a different size.
getMimeType()  : string
getName()  : string
getNameWithoutExtension()  : string
getOriginalResource()  : SystemResourceInterface
getProcessingConfiguration()  : array
Returns the processing configuration this resource was created for.
getProperties()  : array
getProperty()  : mixed
There is no database row to read width/height/size back from like ProcessedFile does, so this falls back to deriving them from the render, or from the original when it is used as-is.
getPublicUrl()  : string|null
A render lives in typo3temp/assets/, a public path of the app package, so its URL is generated by the same publisher as the original's - honouring the site path and config.absRefPrefix, which a FAL ProcessedFile only gets via PublicUrlPrefixer.
getResourceIdentifier()  : string
getSize()  : int
Returns the size of the processed resource in bytes.
getTaskIdentifier()  : string
Returns the task type this resource was created for.
isImage()  : bool
isNew()  : bool
isProcessed()  : bool
needsReprocessing()  : bool
Given the content-addressed cache key ProcessedResourceCache computes this object's render path from, a render that exists at all is, by construction, still current - there is nothing further to compare against, unlike ProcessedFile::needsReprocessing(), which has to detect a changed original against a stored sha1.
setName()  : void
setUsesOriginalFile()  : void
Defines that the original resource should be used as-is, since no processing was needed.
updateProperties()  : void
updateWithLocalFile()  : void
Injects a local file, which is a processing result, into the object.
usesOriginalFile()  : bool

Methods

__construct()

public __construct(ProcessedResourceCache $cache, SystemResourceInterface $originalResource, string $taskType, array $processingConfiguration[, string|null $existingRenderPath = null ][, bool|null $isNew = null ][, array $properties = [] ]) : mixed

Parameters

$cache : ProcessedResourceCache
$originalResource : SystemResourceInterface
$taskType : string
$processingConfiguration : array
$existingRenderPath : string|null = null
$isNew : bool|null = null
$properties : array = []

__toString()

public __toString() : string

Return values

string

delete()

public delete() : bool

Return values

bool

exists()

public exists() : bool

Return values

bool

getContents()

public getContents() : string

Return values

string

getExtension()

public getExtension() : string

Return values

string

getHash()

public getHash() : string

Return values

string

getImageDimension()

Dimensions a processor stored for this resource take precedence, as ProcessedFile does - e.g. an SVG which is reused as-is but rendered at a different size.

public getImageDimension() : ImageDimension

Return values

ImageDimension

getMimeType()

public getMimeType() : string

Return values

string

getName()

public getName() : string

Return values

string

getNameWithoutExtension()

public getNameWithoutExtension() : string

Return values

string

getProcessingConfiguration()

Returns the processing configuration this resource was created for.

public getProcessingConfiguration() : array

Return values

array

getProperties()

public getProperties() : array

Return values

array

getProperty()

There is no database row to read width/height/size back from like ProcessedFile does, so this falls back to deriving them from the render, or from the original when it is used as-is.

public getProperty(string $key) : mixed

Parameters

$key : string

getPublicUrl()

A render lives in typo3temp/assets/, a public path of the app package, so its URL is generated by the same publisher as the original's - honouring the site path and config.absRefPrefix, which a FAL ProcessedFile only gets via PublicUrlPrefixer.

public getPublicUrl() : string|null

Cache busting is not needed for a render, its file name already is a content hash.

Return values

string|null

getResourceIdentifier()

public getResourceIdentifier() : string

Return values

string

getSize()

Returns the size of the processed resource in bytes.

public getSize() : int

Return values

int

getTaskIdentifier()

Returns the task type this resource was created for.

public getTaskIdentifier() : string

Return values

string

isImage()

public isImage() : bool

Return values

bool

isNew()

public isNew() : bool

Return values

bool

isProcessed()

public isProcessed() : bool

Return values

bool

needsReprocessing()

Given the content-addressed cache key ProcessedResourceCache computes this object's render path from, a render that exists at all is, by construction, still current - there is nothing further to compare against, unlike ProcessedFile::needsReprocessing(), which has to detect a changed original against a stored sha1.

public needsReprocessing() : bool

Return values

bool

setName()

public setName(string $name) : void

Parameters

$name : string

setUsesOriginalFile()

Defines that the original resource should be used as-is, since no processing was needed.

public setUsesOriginalFile() : void

updateProperties()

public updateProperties(array $properties) : void

Parameters

$properties : array

updateWithLocalFile()

Injects a local file, which is a processing result, into the object.

public updateWithLocalFile(string $localFilePath) : void

Parameters

$localFilePath : string

usesOriginalFile()

public usesOriginalFile() : bool

Return values

bool
On this page