Skip to content

Commit

Permalink
Updated GD.php, hotfix for pad() transparency (masterexploder#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
bacinsky committed Jun 7, 2018
1 parent 01f6aa6 commit 5cafd82
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/PHPThumb/GD.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']) {
Expand All @@ -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
Expand Down

0 comments on commit 5cafd82

Please sign in to comment.