LocalPreviewHelper
Helper for creating local image previews using TYPO3s image processing classes.
Table of Contents
Methods
- preProcessConfiguration() : array<string|int, mixed>
- Enforce default configuration for preview processing
- process() : array<string|int, mixed>|null
- This method actually does the processing of files locally
- processWithLocalFile() : array<string|int, mixed>|null
- Does the heavy lifting prescribed in processTask() except that the processing can be performed on any given local image
- generatePreviewFromFile() : array<string|int, mixed>
- Generates a preview for a file
- generatePreviewFromLocalFile() : array<string|int, mixed>
- Generates a preview for a local file
- getTemporaryFilePath() : non-empty-string
- Returns the path to a temporary file for processing
Methods
preProcessConfiguration()
Enforce default configuration for preview processing
public
static preProcessConfiguration(array<string|int, mixed> $configuration) : array<string|int, mixed>
Parameters
- $configuration : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>process()
This method actually does the processing of files locally
public
process(TaskInterface $task) : array<string|int, mixed>|null
takes the original file (on remote storages this will be fetched from the remote server) does the IM magic on the local server by creating a temporary typo3temp/ file copies the typo3temp/ file to the processing folder of the target storage removes the typo3temp/ file
The returned array has the following structure: width => 100 height => 200 filePath => /some/path
If filePath isn't set but width and height are the original file is used as ProcessedFile with the returned width and height. This is for example useful for SVG images.
Parameters
- $task : TaskInterface
Return values
array<string|int, mixed>|nullprocessWithLocalFile()
Does the heavy lifting prescribed in processTask() except that the processing can be performed on any given local image
public
processWithLocalFile(TaskInterface $task, string $localFile) : array<string|int, mixed>|null
Parameters
- $task : TaskInterface
- $localFile : string
Return values
array<string|int, mixed>|nullgeneratePreviewFromFile()
Generates a preview for a file
protected
generatePreviewFromFile(File $file, array<string|int, mixed> $configuration, string $targetFilePath) : array<string|int, mixed>
Parameters
- $file : File
-
The source file
- $configuration : array<string|int, mixed>
-
Processing configuration
- $targetFilePath : string
-
Output file path
Return values
array<string|int, mixed>generatePreviewFromLocalFile()
Generates a preview for a local file
protected
generatePreviewFromLocalFile(string $originalFileName, array<string|int, mixed> $configuration, string $targetFilePath) : array<string|int, mixed>
Parameters
- $originalFileName : string
-
Optional input file path
- $configuration : array<string|int, mixed>
-
Processing configuration
- $targetFilePath : string
-
Output file path
Return values
array<string|int, mixed>getTemporaryFilePath()
Returns the path to a temporary file for processing
protected
getTemporaryFilePath(TaskInterface $task) : non-empty-string
Parameters
- $task : TaskInterface