0
我正在使用此code圖像上應用水印爲什麼在應用水印後水印圖像的背景是黑色即使水印是PNG格式並且它是透明的這是腳本zubrag水印的背景是zubrag水印上的黑色腳本
$image_path = $filename;
// Where to save watermarked image
$imgdestpath = $destination_folder . basename($filename);
// Watermark image
$img = new Zubrag_watermark($image_path);
$img->ApplyWatermark($watermark_path);
$img->SaveAsFile($imgdestpath);
$img->Free();
function ApplyWatermark($watermark_path) {
$this->watermark_path = $watermark_path;
// Determine image size and type
$size = getimagesize($this->image_path);
$size_x = $size[0];
$size_y = $size[1];
$image_type = $size[2]; // 1 = GIF, 2 = JPG, 3 = PNG
// load source image
$image = $this->ImageCreateFromType($image_type, $this->image_path);
// Determine watermark size and type
$wsize = getimagesize($watermark_path);
$watermark_x = $wsize[0];
$watermark_y = $wsize[1];
$watermark_type = $wsize[2]; // 1 = GIF, 2 = JPG, 3 = PNG
// load watermark
$watermark = $this->ImageCreateFromType($watermark_type, $watermark_path);
// where do we put watermark on the image?
$dest_x = $size_x - $watermark_x - $this->offset_x;
$dest_y = $size_y - $watermark_y - $this->offset_y;
imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_x, $watermark_y, 100);
$this->image = &$image;
$this->watermark = &$watermark;
$this->image_type = $image_type;
}
它工作正常,但當我旋轉水印它仍然顯示黑色背景 – Anni