php加水印简单功能

$image =imagecreatefromjpeg("xk.jpg");
// $image =imagecreatefrompng("xk.png");
$watermark =imagecreatefrompng("002.png");
$width =imagesx($watermark);
$height = imagesy($watermark);
//将水印加到图片左上角
imagecopyresampled($image,$watermark,340,420,0,0,$width,$height,$width,$height);
imagejpeg($image,"water.jpg",100);
imagedestroy($image);

你可能感兴趣的:(PHP)