Skip to content

Commit 1acd3de

Browse files
authored
Merge pull request #23706 from nextcloud/backport/23680/stable18
[stable18] Enable theming background transparency
2 parents be7c3e3 + d715a63 commit 1acd3de

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/theming/lib/Controller/ThemingController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,17 @@ public function uploadImage(): DataResponse {
286286
// either to big or are not progressive rendering.
287287
$newImage = @imagecreatefromstring(file_get_contents($image['tmp_name'], 'r'));
288288

289+
// Preserve transparency
290+
imagesavealpha($newImage, true);
291+
imagealphablending($newImage, true);
292+
289293
$tmpFile = $this->tempManager->getTemporaryFile();
290294
$newWidth = imagesx($newImage) < 4096 ? imagesx($newImage) : 4096;
291295
$newHeight = imagesy($newImage) / (imagesx($newImage) / $newWidth);
292296
$outputImage = imagescale($newImage, $newWidth, $newHeight);
293297

294298
imageinterlace($outputImage, 1);
295-
imagejpeg($outputImage, $tmpFile, 75);
299+
imagepng($outputImage, $tmpFile, 8);
296300
imagedestroy($outputImage);
297301

298302
$target->putContent(file_get_contents($tmpFile, 'r'));

0 commit comments

Comments
 (0)