Merge pull request #23705 from nextcloud/backport/23680/stable19
[stable19] Enable theming background transparency
This commit is contained in:
commit
e9cfc6fd10
|
@ -285,13 +285,17 @@ class ThemingController extends Controller {
|
||||||
// either to big or are not progressive rendering.
|
// either to big or are not progressive rendering.
|
||||||
$newImage = @imagecreatefromstring(file_get_contents($image['tmp_name'], 'r'));
|
$newImage = @imagecreatefromstring(file_get_contents($image['tmp_name'], 'r'));
|
||||||
|
|
||||||
|
// Preserve transparency
|
||||||
|
imagesavealpha($newImage, true);
|
||||||
|
imagealphablending($newImage, true);
|
||||||
|
|
||||||
$tmpFile = $this->tempManager->getTemporaryFile();
|
$tmpFile = $this->tempManager->getTemporaryFile();
|
||||||
$newWidth = imagesx($newImage) < 4096 ? imagesx($newImage) : 4096;
|
$newWidth = imagesx($newImage) < 4096 ? imagesx($newImage) : 4096;
|
||||||
$newHeight = imagesy($newImage) / (imagesx($newImage) / $newWidth);
|
$newHeight = imagesy($newImage) / (imagesx($newImage) / $newWidth);
|
||||||
$outputImage = imagescale($newImage, $newWidth, $newHeight);
|
$outputImage = imagescale($newImage, $newWidth, $newHeight);
|
||||||
|
|
||||||
imageinterlace($outputImage, 1);
|
imageinterlace($outputImage, 1);
|
||||||
imagejpeg($outputImage, $tmpFile, 75);
|
imagepng($outputImage, $tmpFile, 8);
|
||||||
imagedestroy($outputImage);
|
imagedestroy($outputImage);
|
||||||
|
|
||||||
$target->putContent(file_get_contents($tmpFile, 'r'));
|
$target->putContent(file_get_contents($tmpFile, 'r'));
|
||||||
|
|
Loading…
Reference in New Issue