LocalImageProcessor implements ProcessorInterface, LoggerAwareInterface uses LoggerAwareTrait

Processes Local Images files

Table of Contents

Interfaces

ProcessorInterface
Interface for file processors. All classes capable of processing a file have to implement this interface.
LoggerAwareInterface

Methods

canProcessTask()  : bool
Returns TRUE if this processor can process the given task.
processTask()  : void
Processes the given task.
checkForExistingTargetFile()  : bool
Check if the target file that is to be processed already exists.
generatePreviewFromFile()  : array<string|int, mixed>
Generates a preview for a file
generatePreviewFromLocalFile()  : array<string|int, mixed>
Generates a preview for a local file
generateProcessedFileNameWithoutExtension()  : string
Generate the name of the new File. Should be placed somwhere else?
getFilenameForImageCropScaleMask()  : string
Returns the filename for a cropped/scaled/masked file which will be put in typo3temp for the time being.
getTemporaryFilePathForPreview()  : non-empty-string
Returns the path to a temporary file for processing
processCropScaleMask()  : array<string|int, mixed>|null
This method actually does the processing of files locally
processCropScaleMaskWithLocalFile()  : array<string|int, mixed>|null
Does the heavy lifting prescribed in processTask() except that the processing can be performed on any given local image.
processPreview()  : array<string|int, mixed>|null
This method actually does the processing of files locally
processPreviewWithLocalFile()  : array<string|int, mixed>|null
Does the heavy lifting prescribed in processTask() except that the processing can be performed on any given local image
processTaskWithLocalFile()  : void
Processes an image described in a task, but optionally uses a given local image

Methods

canProcessTask()

Returns TRUE if this processor can process the given task.

public canProcessTask(TaskInterface $task) : bool
Parameters
$task : TaskInterface
Return values
bool

checkForExistingTargetFile()

Check if the target file that is to be processed already exists.

protected checkForExistingTargetFile(TaskInterface $task) : bool

If it exists, use the metadata from that file and mark task as done.

Parameters
$task : TaskInterface
Return values
bool

generatePreviewFromFile()

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>

generateProcessedFileNameWithoutExtension()

Generate the name of the new File. Should be placed somwhere else?

protected generateProcessedFileNameWithoutExtension(TaskInterface $task) : string
Parameters
$task : TaskInterface
Return values
string

getFilenameForImageCropScaleMask()

Returns the filename for a cropped/scaled/masked file which will be put in typo3temp for the time being.

protected getFilenameForImageCropScaleMask(TaskInterface $task) : string
Parameters
$task : TaskInterface
Return values
string

getTemporaryFilePathForPreview()

Returns the path to a temporary file for processing

protected getTemporaryFilePathForPreview(TaskInterface $task) : non-empty-string
Parameters
$task : TaskInterface
Return values
non-empty-string

processCropScaleMask()

This method actually does the processing of files locally

protected processCropScaleMask(TaskInterface $task) : array<string|int, mixed>|null

Takes the original file (for 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 and 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>|null

processCropScaleMaskWithLocalFile()

Does the heavy lifting prescribed in processTask() except that the processing can be performed on any given local image.

protected processCropScaleMaskWithLocalFile(TaskInterface $task, string $originalFileName) : array<string|int, mixed>|null

Note that the resize() method usually does not upscale images (depends on "noScale" option), so the original file would be used for the processor result.

Parameters
$task : TaskInterface
$originalFileName : string
Return values
array<string|int, mixed>|null

processPreview()

This method actually does the processing of files locally

protected processPreview(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>|null

processPreviewWithLocalFile()

Does the heavy lifting prescribed in processTask() except that the processing can be performed on any given local image

protected processPreviewWithLocalFile(TaskInterface $task, string $localFile) : array<string|int, mixed>|null
Parameters
$task : TaskInterface
$localFile : string
Return values
array<string|int, mixed>|null

processTaskWithLocalFile()

Processes an image described in a task, but optionally uses a given local image

protected processTaskWithLocalFile(TaskInterface $task, string|null $localFile) : void
Parameters
$task : TaskInterface
$localFile : string|null
Tags
throws
InvalidArgumentException

        
On this page

Search results