[BUGFIX] Set dimensions for custom svg TYPO3 backend logo 22/50522/10
authorJosef Glatz <josefglatz@gmail.com>
Mon, 7 Nov 2016 12:16:10 +0000 (13:16 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 17 Nov 2016 07:34:54 +0000 (08:34 +0100)
Width and height is automatically set for pixel based backend
logos. This patch makes sure this also is done for svg file format.

Releases: master, 7.6
Resolves: #78590
Change-Id: Iff1dddc827d002e10fd4ec6f3b57bc16920b1c86
Reviewed-on: https://review.typo3.org/50522
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Classes/Controller/BackendController.php

index f6e5854..9731da8 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Type\File\ImageInfo;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
@@ -276,7 +277,10 @@ class BackendController
             $logoWidth = 22;
             $logoHeight = 22;
         } else {
-            list($logoWidth, $logoHeight) = @getimagesize($logoPath);
+            // set width/height for custom logo
+            $imageInfo = GeneralUtility::makeInstance(ImageInfo::class, $logoPath);
+            $logoWidth = $imageInfo->getWidth() ?? '22';
+            $logoHeight = $imageInfo->getHeight() ?? '22';
 
             // High-resolution?
             if (strpos($logoPath, '@2x.') !== false) {