[Pkg-owncloud-commits] [owncloud] 76/258: Preserve transparency when loading from a file
David Prévot
taffit at moszumanska.debian.org
Sat Oct 11 17:22:23 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 86400ea4c89d7141b6122a5a0fda3b6a16987ccc
Author: kondou <kondou at ts.unde.re>
Date: Tue Aug 12 11:00:00 2014 +0200
Preserve transparency when loading from a file
Fix #7148 - again :)
---
lib/private/image.php | 6 ++++++
tests/lib/image.php | 3 +++
2 files changed, 9 insertions(+)
diff --git a/lib/private/image.php b/lib/private/image.php
index 0dff8c5..c055c69 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -450,6 +450,9 @@ class OC_Image {
case IMAGETYPE_GIF:
if (imagetypes() & IMG_GIF) {
$this->resource = imagecreatefromgif($imagePath);
+ // Preserve transparency
+ imagealphablending($this->resource, true);
+ imagesavealpha($this->resource, true);
} else {
OC_Log::write('core',
'OC_Image->loadFromFile, GIF images not supported: '.$imagePath,
@@ -468,6 +471,9 @@ class OC_Image {
case IMAGETYPE_PNG:
if (imagetypes() & IMG_PNG) {
$this->resource = imagecreatefrompng($imagePath);
+ // Preserve transparency
+ imagealphablending($this->resource, true);
+ imagesavealpha($this->resource, true);
} else {
OC_Log::write('core',
'OC_Image->loadFromFile, PNG images not supported: '.$imagePath,
diff --git a/tests/lib/image.php b/tests/lib/image.php
index 131a9d8..795bc46 100644
--- a/tests/lib/image.php
+++ b/tests/lib/image.php
@@ -115,6 +115,9 @@ class Test_Image extends PHPUnit_Framework_TestCase {
public function testData() {
$img = new \OC_Image(OC::$SERVERROOT.'/tests/data/testimage.png');
$raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.png'));
+ // Preserve transparency
+ imagealphablending($raw, true);
+ imagesavealpha($raw, true);
ob_start();
imagepng($raw);
$expected = ob_get_clean();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list