SvgManipulation

Performs SVG cropping by applying a wrapper SVG as view

A simple SVG with an input like this:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 168.4 940.7 724" width="941" height="724"> <path id="path" d="M490.1 655.5c-9.4 1.2-16.9

is wrapped with crop dimensions (i.e. "50 50 640 480") to something like this:

Internal

not part of TYPO3 Core API.

Table of Contents

Methods

cropScaleSvgString()  : DOMDocument
adjustSvgDimensions()  : bool
Ensure that the determined width and height settings are attributes on the original <svg>.
determineSvgDimensions()  : array<string|int, mixed>
Check an input SVG element for its dimensions through width/height/viewBox attributes.

Methods

cropScaleSvgString()

public cropScaleSvgString(string $svgString, Area $cropArea, ImageDimension $imageDimension) : DOMDocument
Parameters
$svgString : string
$cropArea : Area
$imageDimension : ImageDimension
Tags
throws
DOMException
Return values
DOMDocument

adjustSvgDimensions()

Ensure that the determined width and height settings are attributes on the original <svg>.

protected adjustSvgDimensions(DOMDocument $originalSvg, array<string|int, mixed> $determinedDimensions) : bool

If those were missing, cropping could not successfully be applied when getting embedded and adjusted within a element.

Returns true, if the determined width/height has been injected into the main

Parameters
$originalSvg : DOMDocument
$determinedDimensions : array<string|int, mixed>
Return values
bool

determineSvgDimensions()

Check an input SVG element for its dimensions through width/height/viewBox attributes.

protected determineSvgDimensions(DOMDocument $originalSvg) : array<string|int, mixed>

Returns an array with the determined width/height.

Parameters
$originalSvg : DOMDocument
Return values
array<string|int, mixed>

        
On this page

Search results