mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
For png images with transparency, the imagesaveaplpha() needs to be set to true on the source image in order for the alpha to be preserved when using the modifier methods.
This commit is contained in:
parent
aebbb10c9f
commit
797d526c60
@ -30,7 +30,12 @@ class GD extends Object {
|
|||||||
switch($type) {
|
switch($type) {
|
||||||
case 1: if(function_exists('imagecreatefromgif')) $this->setGD(imagecreatefromgif($filename)); break;
|
case 1: if(function_exists('imagecreatefromgif')) $this->setGD(imagecreatefromgif($filename)); break;
|
||||||
case 2: if(function_exists('imagecreatefromjpeg')) $this->setGD(imagecreatefromjpeg($filename)); break;
|
case 2: if(function_exists('imagecreatefromjpeg')) $this->setGD(imagecreatefromjpeg($filename)); break;
|
||||||
case 3: if(function_exists('imagecreatefrompng')) $this->setGD(imagecreatefrompng($filename)); break;
|
case 3: if(function_exists('imagecreatefrompng')) {
|
||||||
|
$img = imagecreatefrompng($filename);
|
||||||
|
imagesavealpha($img, true); // save alphablending setting (important)
|
||||||
|
$this->setGD($img);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user