SvgImageProcessor implements ProcessorInterface

Processes (scales) SVG Images files or crops them via \DOMDocument and creates a new locally created processed file which is then pushed into FAL again.

Table of Contents

Interfaces

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

Methods

canProcessTask()  : bool
Returns TRUE if this processor can process the given task.
processTask()  : void
Processes the given task.
applyCropping()  : void
Create standalone wrapper files for SVGs.
checkForExistingTargetFile()  : bool
Check if the target file that is to be processed already exists.
getFilenameForSvgCropScaleMask()  : string
Returns the filename for a cropped/scaled/masked file which will be put in typo3temp for the time being.

Methods

canProcessTask()

Returns TRUE if this processor can process the given task.

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

applyCropping()

Create standalone wrapper files for SVGs.

protected applyCropping(TaskInterface $task, Area $cropArea, ImageDimension $imageDimension) : void

Cropped responsive images delivered via an tag or as a URI for a background image, need to be self-contained. Therefore we wrap a container around the original SVG content. A viewBox() crop is then applied to that container. The processed file will contain all the viewBox cropping information and thus transports intrinsic sizes for all variants of CSS processing (max/min width/height).

Parameters
$task : TaskInterface
$cropArea : Area
$imageDimension : ImageDimension

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
Tags
throws
InsufficientFolderReadPermissionsException
todo
  • Refactor this 80% duplicate code of LocalImageProcessor::checkForExistingTargetFile
Return values
bool

getFilenameForSvgCropScaleMask()

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

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

        
On this page

Search results