请问是否有任何PHP脚本我可以将我的网站名称附加到图片上,以便当用户从我的网站下载任何图片或图片时,我的网站名称将被附加在那里,就像快门股票一样。请帮忙!谢谢!
答案 0 :(得分:1)
你应该使用php watermark函数。
中心定位水印
<?php
// Load the stamp and the photo to apply the watermark to
$stamp = imagecreatefrompng('stampimg.png');
$im = imagecreatefrompng('mainimage.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);
$imgx = imagesx($im);
$imgy = imagesy($im);
$centerX=round($imgx/2);
$centerY=round($imgy/2);
// Copy the stamp image onto our photo using the margin offsets and the photo
// width to calculate positioning of the stamp.
imagecopy($im, $stamp, $centerX, $centerY, 0, 0, imagesx($stamp), imagesy($stamp));
// Output and free memory
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>