2013-09-30 47 views
-4

請在這裏附上我的網站名稱附加的任何PHP腳本,以便用戶從我的網站下載任何圖片或圖像時,我的網站名稱將被附加在那裏,就像百葉窗是如何做到的。請幫忙!謝謝!在圖片或圖片上附上網站名稱

+2

對不起,我們這裏不提供腳本的建議。提問前請先看[問]。 –

+0

嘗試玩php圖像功能和gd庫 – Lab

回答

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