该函数的一个典型应用就是将图像打上水印标识:
<? header("Content-type: image/jpeg"); //原始图像 $dst = "images/flower_1.jpg"; //得到原始图片信息 $dst_im = imagecreatefromjpeg($dst); $dst_info = getimagesize($dst); //水印图像 $src = "images/logo.gif"; $src_im = imagecreatefromgif($src); $src_info = getimagesize($src); //水印透明度 $alpha = 30; //合并水印图片 imagecopymerge($dst_im,$src_im,$dst_info[0]-$src_info[0],$dst_info[1]-$src_info[1],0,0,$src_info[0], $src_info[1],$alpha); //输出合并后水印图片 imagejpeg($dst_im); imagedestroy($dst_im); imagedestroy($src_im); ?>