Project

General

Profile

Actions

Bug #91097

open

ImageInfo::extractSvgImageSizes() does not check for width/height in percent

Added by Georg Tiefenbrunn almost 4 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-04-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

extractSvgImageSizes() can't extract the dimensions of SVG files having width/height as percentage length values.

$xmlAttributes['width'] and $xmlAttributes['height'] are both cast to integer in https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/Type/File/ImageInfo.php#L136

<svg width="600" height="450">                           -> OK 600 x 450
<svg viewBox="0 0 600 450">                              -> OK 600 x 450
<svg width="100%" height="100%" viewBox="0 0 600 450">   -> FALSE 100 x 100

I have no idea how to handle length values defined in em, ex, in, cm, mm, pt or pc, but px should be returned as int and % should be returned as 0.

The current implementation only works for viewBox="0 0 w h". w/h should only be extracted from viewBox if x/y=0.

$xmlAttributes['viewBox'] in Line 140 should be cast to string to prevent TypeError (explode() expects parameter 2 to be string, object given).

Links:

No data to display

Actions

Also available in: Atom PDF