PHP judge source display image watermark

Source: Internet
Author: User

 

<?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) &nbsp {      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  ?> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.