Commit 8a25db00 authored by crell's avatar crell Committed by Benni Mack
Browse files

[BUGFIX] Simplify code in ImageInfo

Resolves: #97745
Releases: main
Change-Id: I903f04c8eba97e7e4fb148041288da843ea1647d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74830


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarJoey Bouten <joey.bouten@beech.it>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 12da9f62
......@@ -1370,11 +1370,6 @@ parameters:
count: 1
path: ../../typo3/sysext/core/Classes/Type/Enumeration.php
-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 1
path: ../../typo3/sysext/core/Classes/Type/File/ImageInfo.php
-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 1
......
......@@ -145,16 +145,15 @@ class ImageInfo extends FileInfo implements LoggerAwareInterface
// First check if width+height are set
if (!empty($xmlAttributes['width']) && !empty($xmlAttributes['height'])) {
$imagesSizes = [(int)$xmlAttributes['width'], (int)$xmlAttributes['height']];
} elseif (!empty($xmlAttributes['viewBox'])) {
return [(int)$xmlAttributes['width'], (int)$xmlAttributes['height']];
}
if (!empty($xmlAttributes['viewBox'])) {
// Fallback to viewBox
$viewBox = explode(' ', $xmlAttributes['viewBox']);
$imagesSizes = [(int)$viewBox[2], (int)$viewBox[3]];
} else {
// To not fail image processing, we just assume an SVG image dimension here
$imagesSizes = [64, 64];
return [(int)$viewBox[2], (int)$viewBox[3]];
}
return $imagesSizes !== [] ? $imagesSizes : false;
// To not fail image processing, we just assume an SVG image dimension here
return [64, 64];
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment