Enable theming background transparency

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2020-10-25 19:15:52 +01:00 committed by backportbot[bot]
parent 429700ac3a
commit 3e4e05bb93
1 changed files with 5 additions and 1 deletions

View 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));