SvgImageProcessor implements ProcessorInterface

Read onlyYes

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.

Attributes
#[Autoconfigure]
$public: true

Table of Contents

Interfaces

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

Methods

__construct()  : mixed
canProcessTask()  : bool
Returns TRUE if this processor can process the given task.
processTask()  : void
Processes the given task.
applyCropping()  : void
Wrap the source SVG in a crop container and write it to a temporary processed file. The wrapper carries the viewBox crop and target dimensions so the result is self-contained when embedded via <img>.
checkForExistingTargetFile()  : bool
Check if the target file that is to be processed already exists.
generateProcessedFileNameWithoutExtension()  : string
Generate the name of the new File. Should be placed somwhere else?
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()

Wrap the source SVG in a crop container and write it to a temporary processed file. The wrapper carries the viewBox crop and target dimensions so the result is self-contained when embedded via <img>.

protected applyCropping(TaskInterface $task, Area $cropArea, ImageDimension $imageDimension) : void
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

generateProcessedFileNameWithoutExtension()

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

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

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