[BUGFIX] Set dimensions for custom svg TYPO3 backend logo 64/50864/2
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 17 Nov 2016 07:49:08 +0000 (08:49 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Fri, 2 Dec 2016 23:50:35 +0000 (00:50 +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/50864
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Controller/BackendController.php

index 532a0f8..44a0ea7 100644 (file)
@@ -21,6 +21,7 @@ use TYPO3\CMS\Backend\Module\ModuleLoader;
 use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 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;
@@ -279,7 +280,11 @@ class BackendController
         // Render the TYPO3 logo in the left corner
         $logoUrl = $GLOBALS['TBE_STYLES']['logo'] ?: ExtensionManagementUtility::extRelPath('backend') . 'Resources/Public/Images/typo3-topbar@2x.png';
         $logoPath = GeneralUtility::resolveBackPath(PATH_typo3 . $logoUrl);
-        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($logoUrl, '@2x.') !== false) {