diff --git a/plugins/CoreAdminHome/CustomLogo.php b/plugins/CoreAdminHome/CustomLogo.php index 1483e83ec60cee4aaeec9fcf736c0c5623a7eb82..79aa7de71d629e8376d9f86fc8d5e51ed16e1233 100644 --- a/plugins/CoreAdminHome/CustomLogo.php +++ b/plugins/CoreAdminHome/CustomLogo.php @@ -195,21 +195,20 @@ class CustomLogo return false; } - $smallWidthExpected = round($width * $targetHeight / $height); + $targetWidth = round($width * $targetHeight / $height); - $logoSmall = imagecreatetruecolor($smallWidthExpected, $targetHeight); - - // Handle transparency - $backgroundSmall = imagecolorallocate($logoSmall, 0, 0, 0); - imagecolortransparent($logoSmall, $backgroundSmall); + $newImage = imagecreatetruecolor($targetWidth, $targetHeight); if ($_FILES[$uploadFieldName]['type'] == 'image/png') { - imagealphablending($logoSmall, false); - imagesavealpha($logoSmall, true); + imagealphablending($newImage, false); + imagesavealpha($newImage, true); } - imagecopyresized($logoSmall, $image, 0, 0, 0, 0, $smallWidthExpected, $targetHeight, $width, $height); - imagepng($logoSmall, PIWIK_DOCUMENT_ROOT . '/' . $userPath, 3); + $backgroundColor = imagecolorallocate($newImage, 0, 0, 0); + imagecolortransparent($newImage, $backgroundColor); + + imagecopyresampled($newImage, $image, 0, 0, 0, 0, $targetWidth, $targetHeight, $width, $height); + imagepng($newImage, PIWIK_DOCUMENT_ROOT . '/' . $userPath, 3); return true; } diff --git a/plugins/Dashboard/javascripts/dashboard.js b/plugins/Dashboard/javascripts/dashboard.js index 85e8d37cf03c72d2eb5af86319b281dc1acfa3bf..9ec9cd1b7d7217afa138b3cb11b1b76256f58bda 100644 --- a/plugins/Dashboard/javascripts/dashboard.js +++ b/plugins/Dashboard/javascripts/dashboard.js @@ -8,6 +8,7 @@ function initDashboard(dashboardId, dashboardLayout) { $('.dashboardSettings').show(); + initTopControls(); // Embed dashboard if (!$('#topBars').length) {