我有一個圖像,我試圖使用文本水印圖像。在PHP中使用文本水印圖像
我已經完成了代碼部分,但沒有看到圖像看到水印文本。
這裏是下面的代碼:
$imagetobewatermark="images/muggu.png";
list($width,$height)=getimagesize($imagetobewatermark);
$imagetobewatermark=imagecreatetruecolor($width,$height);
$mark=imagecreatefrompng($imagetobewatermark);
imagecopy($imagetobewatermark,$mark,0,0,0,0,$width,$height);
$wartermarktext="Muggu";
$font="../font/century gothic.ttf";
$fontsize="15";
$white = imagecolorallocate($imagetobewatermark, 255, 255, 255);
imagettftext($imagetobewatermark, $fontsize, 0, 20, 10, $white, $font, $watermarktext);
header("Content-type:image/png");
imagepng($imagetobewatermark);
imagedestroy($imagetobewatermark);
告訴我,如果我錯了。
謝謝。
爲什麼你不使用像干預/圖像包? – Aristona
啊,錯字!我更新了我的答案... – Raad