我试图设置制作水印的程序。
代码:
//添加水印
// Load the stamp and the photo to apply the watermark to
$stamp = imagecreatefrompng('./uploads/waterstamp.png');
// Set the margins for the stamp and get the height/width of the stamp image
$marge_right = 10;
$marge_bottom = 10;
$sx = imagesx($stamp);
$sy = imagesy($stamp);
// Copy the stamp image onto our photo using the margin offsets and the photo
// width to calculate positioning of the stamp.
imagecopy($rotate, $stamp, imagesx($rotate) - $sx - $marge_right, imagesy($rotate) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
// Output and free memory
imagejpeg($rotate, $filename);
imagedestroy($source);
imagedestroy($rotate);
它有效,但不一致。水印在右边。在其中一张照片中看起来是正确的,但在一张照片中它是一个白色的边框。我不得不附上显示问题的屏幕截图。
有什么想法吗?