如何解决我在更改水印宽度方面有问题
我使用此代码在图像上添加水印。 当我更改 $sx,$sy 时的问题,它会剪切水印而不改变大小。
我该怎么办?
代码:
$sx = imagesx($stamp);
$sy = imagesy($stamp);
$des_width = imagesx($im);
$des_height = imagesy($im);
$xpos = $des_width - $sx - $marge_right;
$ypos = $des_height - $sy - $marge_bottom;
$trans_background = imagecolorallocatealpha($im,127);
$dest_image = imagecreatetruecolor($des_width,$des_height);
imagesavealpha($dest_image,true);
$trans_background = imagecolorallocatealpha($dest_image,127);
imagefill($dest_image,$trans_background);
imagecopy($dest_image,$im,$des_width,$des_height);
imagecopy($dest_image,$stamp,$xpos,$ypos,$sx,$sy);
if(pathinfo($file,PATHINFO_EXTENSION) == 'png'){
imagepng($dest_image,$file);
} else {
imagejpeg($dest_image,$file,99);
}
imagedestroy($stamp);
imagedestroy($im);
imagedestroy($dest_image);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。