TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LocalPreviewHelper Class Reference

Public Member Functions

 __construct (LocalImageProcessor $processor)
 
 process (TaskInterface $task)
 

Protected Member Functions

 getTemporaryFilePath (TaskInterface $task)
 

Protected Attributes

 $processor
 

Detailed Description

Helper for creating local image previews using TYPO3s image processing classes.

Definition at line 26 of file LocalPreviewHelper.php.

Constructor & Destructor Documentation

__construct ( LocalImageProcessor  $processor)
Parameters
LocalImageProcessor$processor

Definition at line 36 of file LocalPreviewHelper.php.

References LocalPreviewHelper\$processor.

Member Function Documentation

getTemporaryFilePath ( TaskInterface  $task)
protected

Returns the path to a temporary file for processing

Parameters
TaskInterface$task
Returns
string

Definition at line 85 of file LocalPreviewHelper.php.

References TaskInterface\getTargetFileExtension(), and GeneralUtility\tempnam().

Referenced by LocalPreviewHelper\process().

process ( TaskInterface  $task)

This method actually does the processing of files locally

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
TaskInterface$task
Returns
array|NULL

Definition at line 60 of file LocalPreviewHelper.php.

References MathUtility\forceIntegerInRange(), TaskInterface\getConfiguration(), TaskInterface\getSourceFile(), and LocalPreviewHelper\getTemporaryFilePath().

Member Data Documentation

$processor
protected

Definition at line 31 of file LocalPreviewHelper.php.

Referenced by LocalPreviewHelper\__construct().