การสร้างลายน้ำ

ตัวอย่างการสร้างลายน้ำ (Watermark)

ไฟล์ code/image/watermark.php

<?php
header('Content-Type: image/png');
$string = "phpmysql";
$im = imagecreate(600, 600);
$color = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im, 0, 0, $color);
$text_color = imagecolorallocate($im, 255, 255, 255);
for($x=5;$x<600;$x+=150)
	for($y=5;$y<600;$y+=80)
		imagestring($im, 5, $x, $y, $string, $text_color);
imagepng($im,null);
imagedestroy($im);
?>

คำสั่ง html
<img src="/code/php/watermark.php">
ผลลัพธ์