0

私はこの公開機能を持っています:

 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;
}

画像をプレビューすると問題が発生します。アルファカラーは表示されません。助けてもらえますか?

4

1 に答える 1

0

imagealphablendingをfalseではなくtrueに設定してみてください。

于 2012-12-04T12:02:14.473 に答える