From fa461befbc940a6dd5dd40843551d2c3d1a3c34b Mon Sep 17 00:00:00 2001 From: Georg Ehrke <developer@georgehrke.com> Date: Wed, 30 Jul 2014 12:16:03 +0200 Subject: [PATCH] extract transparency fix from #8050 --- lib/private/image.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/private/image.php b/lib/private/image.php index 5331c39915..0dff8c5a9d 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -870,6 +870,14 @@ class OC_Image { imagedestroy($process); return false; } + + // preserve transparency + if($this->imageType == IMAGETYPE_GIF or $this->imageType == IMAGETYPE_PNG) { + imagecolortransparent($process, imagecolorallocatealpha($process, 0, 0, 0, 127)); + imagealphablending($process, false); + imagesavealpha($process, true); + } + imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h); if ($process == false) { OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$w.'x'.$h, OC_Log::ERROR); -- GitLab