Published in: PHP
<? function image_watermark($img, $wmg) { $ix = imagesx($img); $iy = imagesy($img); $wx = imagesx($wmg); $wy = imagesy($wmg); $fmg = imagecreatetruecolor($ix, $iy); imagealphablending($fmg, true); imagecopy($fmg, $img, 0, 0, 0, 0, $ix, $iy); for($sx = 0; $sx < $ix; $sx += $wx) { for($sy = 0; $sy < $iy; $sy += $wy) { } } return $fmg; } $img = imagecreatefromjpeg('image.jpg'); $wmg = imagecreatefrompng('watermark.png'); $fmg = image_watermark($img, $wmg); imagejpeg($fmg); ?>
You need to login to post a comment.
