From 77571fb2d3946bd9ad59c9f95d8ec3bd323f2dff Mon Sep 17 00:00:00 2001 From: Peter Bacinsky Date: Wed, 10 Sep 2014 15:52:10 +0200 Subject: [PATCH] Updated GD.php, hotfix for pad() transparency (https://github.com/masterexploder/PHPThumb/issues/111) --- src/PHPThumb/GD.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/PHPThumb/GD.php b/src/PHPThumb/GD.php index 350bf19..4288af7 100644 --- a/src/PHPThumb/GD.php +++ b/src/PHPThumb/GD.php @@ -130,7 +130,7 @@ public function __destruct() * @param array $color * @return GD */ - public function pad($width, $height, $color = array(255, 255, 255)) + public function pad($width, $height, $color = array(255, 255, 255, 127)) { // no resize - woohoo! if ($width == $this->currentDimensions['width'] && $height == $this->currentDimensions['height']) { @@ -144,12 +144,16 @@ public function pad($width, $height, $color = array(255, 255, 255)) $this->workingImage = imagecreate($width, $height); } + imagealphablending($this->workingImage, false); + imagesavealpha($this->workingImage, true); + // create the fill color - $fillColor = imagecolorallocate( + $fillColor = imagecolorallocatealpha( $this->workingImage, $color[0], $color[1], - $color[2] + $color[2], + $color[3] ); // fill our working image with the fill color