<?php //# config file php100.com $floder = '; #图片保存文件夹 $waterpic = ' win.png '; #水印图片地址 $referer = ' Kalvin '; #来源页包含字符串 //# config file header ("Content-type:image/png"); # Set output file header $filename = $floder. $_get["filename"]; # Set source file address $SOURCEIMG = Imagecreatefromjpeg ($filename); # Read source image $WATERIMG = Imagecreatefrompng ($waterpic); # Read Watermark logo $BG _color = Imagecolorat ($WATERIMG, 1, 1); # Remove the logo to be transparent color imagecolortransparent ($WATERIMG, $BG _color); # The color $sourceX = Imagesx ($SOURCEIMG) that need to be transparent in the set logo; # get Source image width $sourceY = Imagesy ($SOURCEIMG); # get source image height $waterX = Imagesx ($WATERIMG); # Get logo image width $waterY = Imagesy ($WATERIMG); # get symbol like height $x = ($sourceX-$waterX)/2; $y = ($sourceY-$waterY)/2; #计算中心位置 if (isset ($_server[' http_referer ')) && strpos ($_server[' http_referer '], $referer) = = False)   { Imagecopymerge ($SOURCEIMG, $WATERIMG, $x, $y, 0, 0, $waterX, $waterY,); #合并图像 the merge degree is set to 50.100 for a full merge. The equivalent of the image in the second parameter transparent to the original 50/100 and then affixed to the first parameter of the image } imagepng ($SOURCEIMG); #输出图像 php100.com ?>