Skip to content

Commit 6dd3785

Browse files
authored
Merge pull request #23680 from nextcloud/fix/theming/background-transparency
Enable theming background transparency
2 parents e7a8061 + 68f1f44 commit 6dd3785

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apps/theming/lib/ImageManager.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,17 @@ public function updateImage(string $key, string $tmpFile) {
228228
// either to big or are not progressive rendering.
229229
$newImage = @imagecreatefromstring(file_get_contents($tmpFile));
230230

231+
// Preserve transparency
232+
imagesavealpha($newImage, true);
233+
imagealphablending($newImage, true);
234+
231235
$tmpFile = $this->tempManager->getTemporaryFile();
232236
$newWidth = (int)(imagesx($newImage) < 4096 ? imagesx($newImage) : 4096);
233237
$newHeight = (int)(imagesy($newImage) / (imagesx($newImage) / $newWidth));
234238
$outputImage = imagescale($newImage, $newWidth, $newHeight);
235239

236240
imageinterlace($outputImage, 1);
237-
imagejpeg($outputImage, $tmpFile, 75);
241+
imagepng($outputImage, $tmpFile, 8);
238242
imagedestroy($outputImage);
239243

240244
$target->putContent(file_get_contents($tmpFile));

0 commit comments

Comments
 (0)