Skip to content

Commit e9cfc6f

Browse files
authored
Merge pull request #23705 from nextcloud/backport/23680/stable19
[stable19] Enable theming background transparency
2 parents 93bc5ea + 09d4aa3 commit e9cfc6f

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
@@ -285,13 +285,17 @@ public function uploadImage(): DataResponse {
285285
// either to big or are not progressive rendering.
286286
$newImage = @imagecreatefromstring(file_get_contents($image['tmp_name'], 'r'));
287287

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

293297
imageinterlace($outputImage, 1);
294-
imagejpeg($outputImage, $tmpFile, 75);
298+
imagepng($outputImage, $tmpFile, 8);
295299
imagedestroy($outputImage);
296300

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

0 commit comments

Comments
 (0)