Add transparent watermarks to images using the gd Library _ PHP Tutorial

Source: Internet
Author: User
Tags transparent watermark
Add a transparent watermark to the image through the gd Library. Please check the source file. note: Do you need GD2.0 or above to have transparent results? Php (as the mainstream development language) header (Content-type: imagepng?#logoimageimagecreatefrompng(test.png); view the source file
Note: transparent effects can be achieved only when GD 2.0 or more is required
Header ("Content-type: image/png ");
$ LogoImage = ImageCreateFromPNG(test.png );
$ PhotoImage = imagecreatefrom#(back.jpg );
ImageAlphaBlending ($ photoImage, true );
$ LogoW = ImageSX ($ logoImage );
$ LogoH = ImageSY ($ logoImage );
ImageCopy ($ photoImage, $ logoImage, 0, 0, 0, 0, $ logoW, $ logoH );
ImageJPEG ($ photoImage); // output to browser
ImageDestroy ($ photoImage );
ImageDestroy ($ logoImage );
?>

Warning note: Can transparent effects be achieved only when GD 2.0 or more is required? Php (as the mainstream development language) header ("Content-type: image/png"); logoImage = ImageCreateFromPNG(test.png );...

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.