【问题标题】:PNG image alpha color issue with phpphp的PNG图像Alpha颜色问题
【发布时间】:2012-12-04 11:55:19
【问题描述】:

我有这个公共功能:

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

【问题讨论】:

    标签: php image alpha


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2015-04-03
      • 1970-01-01
      • 2014-02-15
      • 2018-07-25
      • 1970-01-01
      • 2019-08-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-25
      相关资源
      最近更新 更多