You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to make the method use transparent background (or preserve it from original image) for the padded output image?
// this will show image with white background:$thumb = newGD($imgPath);
$thumb->resize(40, 40);
$thumb->pad(40, 40, [255, 255, 255]);
$thumb->save($thumbFilePath);
// this (I WOULD LIKE) will show image with transparent background:$thumb = newGD($imgPath);
$thumb->resize(40, 40);
$thumb->pad(40, 40, false); // or any other call format to specify we wont transparent background$thumb->save($thumbFilePath);
this is how i patched GD class, i don't know if it is the correct way, also tried with preserveAlpha with no result!
// near line 147if (!$color) {
imagealphablending($this->workingImage, false);
$fillColor = imagecolorallocatealpha($this->workingImage, 0, 0, 0, 127);
imagefill($this->workingImage, 0, 0, $fillColor);
imagesavealpha($this->workingImage, true);
} else {
// create the fill color$fillColor = imagecolorallocate(
$this->workingImage, $color[0], $color[1], $color[2]
);
// fill our working image with the fill colorimagefill(
$this->workingImage, 0, 0, $fillColor
);
}
The text was updated successfully, but these errors were encountered:
Is there a way to make the method use transparent background (or preserve it from original image) for the padded output image?
this is how i patched GD class, i don't know if it is the correct way, also tried with preserveAlpha with no result!
The text was updated successfully, but these errors were encountered: