ProcessedResource
final class \
- 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.
Internal
Not part of TYPO3's public API, use FileProcessingService instead
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
stringdelete()
public
delete() : bool
Return values
boolexists()
public
exists() : bool
Return values
boolgetContents()
public
getContents() : string
Return values
stringgetExtension()
public
getExtension() : string
Return values
stringgetHash()
public
getHash() : string
Return values
stringgetImageDimension()
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
ImageDimensiongetMimeType()
public
getMimeType() : string
Return values
stringgetName()
public
getName() : string
Return values
stringgetNameWithoutExtension()
public
getNameWithoutExtension() : string
Return values
stringgetOriginalResource()
public
getOriginalResource() : SystemResourceInterface
Return values
SystemResourceInterfacegetProcessingConfiguration()
Returns the processing configuration this resource was created for.
public
getProcessingConfiguration() : array
Return values
arraygetProperties()
public
getProperties() : array
Return values
arraygetProperty()
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|nullgetResourceIdentifier()
public
getResourceIdentifier() : string
Return values
stringgetSize()
Returns the size of the processed resource in bytes.
public
getSize() : int
Return values
intgetTaskIdentifier()
Returns the task type this resource was created for.
public
getTaskIdentifier() : string
Return values
stringisImage()
public
isImage() : bool
Return values
boolisNew()
public
isNew() : bool
Return values
boolisProcessed()
public
isProcessed() : bool
Return values
boolneedsReprocessing()
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
boolsetName()
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