Jump to content
php.lv forumi

watermark


ray

Recommended Posts

No neta ņēmu watermark kodu, bet man nezin kapēc liek virsū nevis caurspīdīgu watermark bildi, bet ar baltu fonu. Pats PNG ir bez fona.

 

Kods:

header('content-type: image/jpeg');
$watermark = imagecreatefrompng('1.png');
$watermark_width = imagesx($watermark);  
$watermark_height = imagesy($watermark);
$image = imagecreatefromjpeg('bb.jpg');
$size = getimagesize('bb.jpg');
$dest_x = $size[0] - $watermark_width - 5;  
$dest_y = $size[1] - $watermark_height - 5;
imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);
imagejpeg($image);  
imagedestroy($image);  
imagedestroy($watermark);

Link to comment
Share on other sites

×
×
  • Create New...