在图像或图片上附加网站名称

时间:2013-09-30 19:52:58

标签: javascript php jquery html css

请问是否有任何PHP脚本我可以将我的网站名称附加到图片上,以便当用户从我的网站下载任何图片或图片时,我的网站名称将被附加在那里,就像快门股票一样。请帮忙!谢谢!

1 个答案:

答案 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);
?>