PNG图像alpha颜色问题与PHP

时间:2012-12-04 11:55:20

标签: php image alpha

我有这个公共职能:

 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颜色。我可以得到一些帮助吗?

1 个答案:

答案 0 :(得分:0)

尝试将imagealphablending设置为true,而不是false。