PHP transparent watermark generation code _ PHP Tutorial

Source: Internet
Author: User
PHP transparent watermark generation code. Copy the code as follows :? Php ** Createdon2010-10-27 * BYQQ542900563 * CopyrightsReserved2000-2020 * This example shows how to generate the image watermark * load two pictures respectively The code is as follows:


/*
* Created on 2010-10-27
* BY QQ542900563
* Copyrights Reserved 2000-2020
* This example shows how to generate an image watermark.
*/
// Load two images respectively
$ Im = imagecreatefromjpeg ("liu.jpg ");
$ Img2 = imagecreatefrompng ("m.png ");

// Obtain their respective lengths and widths and calculate their positions
$ Im_WH = getimagesize ("liu.jpg ");
$ Im_W = $ im_WH [0];
$ Im_H = $ im_WH [1];

$ Img2_WH = getimagesize ("m.png ");
$ Img2_W = $ img2_WH [0];
$ Img2_H = $ img2_WH [1];

// Define the storage location
$ NewX = $ im_W-$ img2_W;
$ NewY = $ im_H-$ img2_H;

// Fill
Imagecopy ($ im, $ img2, $ NewX, $ NewY, 0, $ img2_W, $ img2_H );

Header ("Content-type: image/jpeg ");
Imagejpeg ($ im );

?>

The http://www.bkjia.com/PHPjc/325917.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/325917.htmlTechArticle code is as follows :? Php/** Created on 2010-10-27 * BY QQ542900563 * Copyrights Reserved 2000-2020 * This example demonstrates how to generate an image watermark * // load two images respectively...

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.