]> source.dussan.org Git - nextcloud-server.git/commitdiff
Enable theming background transparency 23699/head
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Sun, 25 Oct 2020 18:15:52 +0000 (19:15 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 26 Oct 2020 19:51:38 +0000 (19:51 +0000)
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
apps/theming/lib/ImageManager.php

index 3fe76899dcdcbada245bb69d704c9950a971d1b7..5c2f2d017962cbe74b35b62326f100c978d20fdf 100644 (file)
@@ -228,13 +228,17 @@ class ImageManager {
                        // either to big or are not progressive rendering.
                        $newImage = @imagecreatefromstring(file_get_contents($tmpFile));
 
+                       // Preserve transparency
+                       imagesavealpha($newImage, true);
+                       imagealphablending($newImage, true);
+
                        $tmpFile = $this->tempManager->getTemporaryFile();
                        $newWidth = (int)(imagesx($newImage) < 4096 ? imagesx($newImage) : 4096);
                        $newHeight = (int)(imagesy($newImage) / (imagesx($newImage) / $newWidth));
                        $outputImage = imagescale($newImage, $newWidth, $newHeight);
 
                        imageinterlace($outputImage, 1);
-                       imagejpeg($outputImage, $tmpFile, 75);
+                       imagepng($outputImage, $tmpFile, 8);
                        imagedestroy($outputImage);
 
                        $target->putContent(file_get_contents($tmpFile));