|
|
|
| при наложении png на png(прозрачность) возникает черный шум как избавиться от этого
$this->watermark = imagecreatefrompng($this->photo);
if($this->auto){$this->new_h=ceil(ImageSY($this->watermark)/(ImageSX($this->watermark)/$this->new_w));}
$this->dst_img = imagecreatetruecolor($this->new_w, $this->new_h);
$this->colorcount = imagecolorstotal($this->watermark);
imagepalettecopy($this->dst_img,$this->watermark);
$this->transparentcolor = imagecolortransparent($this->watermark);
imagefill($this->dst_img,0,0,$this->transparentcolor);
imagecolortransparent($this->dst_img,$this->transparentcolor);
imagecopyresampled($this->dst_img, $this->watermark, 0, 0, 0, 0,$this->new_w,$this->new_h, imagesx($this->watermark), imagesy($this->watermark));
if(isset($this->logo)){
$this->watermark = imagecreatefrompng($this->logo);
imagealphablending($this->watermark,true);
$this->gow=$this->new_w - imagesx($this->watermark);
$this->goh=$this->new_h - imagesy($this->watermark);
imagecopy($this->dst_img,$this->watermark,$this->gow,$this->goh,0,0,imagesx($this->watermark),imagesy($this->watermark));
}else{ImageCopyResized($this->dst_img,$this->watermark,$this->gow,$this->goh,0,0,$this->new_w,$this->new_h,ImageSX($this->watermark),ImageSY($this->watermark));}
if($this->new_file)$this->new_file.=".jpg";else$this->header();
imagejpeg($this->dst_img,$this->new_file,85);
imagedestroy($this->dst_img);
|
| |
|
|