我有这个公共职能:
public function resize($width, $height)
{
$newImage = imagecreatetruecolor($width, $height);
if($this->_imageType == IMAGETYPE_PNG && $this->_transparent === true){
imagealphablending($newImage, false);
imagesavealpha($newImage, true);
imagefilledrectangle($newImage, 0, 0, $width, $height, imagecolorallocatealpha($newImage, 255, 255, 255, 127));
}
imagecopyresampled($newImage, $this->_image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->_image = $newImage;
}
我预览图像时出现问题。它不显示alpha颜色。我可以得到一些帮助吗?
答案 0 :(得分:0)
尝试将imagealphablending设置为true,而不是false。