]> source.dussan.org Git - nextcloud-server.git/commitdiff
extract transparency fix from #8050
authorGeorg Ehrke <developer@georgehrke.com>
Wed, 30 Jul 2014 10:16:03 +0000 (12:16 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 30 Jul 2014 14:13:33 +0000 (16:13 +0200)
lib/private/image.php

index 5331c399159e0e54b2902c92e08e52cbd613c101..0dff8c5a9daecb4a366654ef3257739af331f05e 100644 (file)
@@ -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);