Imagecopymerge () function Create translucent watermark step

Source: Internet
Author: User
This time to bring you Imagecopymerge () function to create a translucent watermark step in detail, imagecopymerge () function to create a translucent watermark note what, the following is the actual case, take a look.

<?php//load the image to be watermarked $im = imagecreatefromjpeg (' photo.jpeg ');//First we manually create a watermark image from GD $stamp = imagecreatetruecolor (100, 70); Imagefilledrectangle ($stamp, 0, 0, 0x0000FF), Imagefilledrectangle ($stamp, 9, 9, 0xFFFFFF), Imagestring ($ Stamp, 5, D, ' libgd ', 0x0000FF), Imagestring ($stamp, 3,, ' (c) 2007-9 ', 0x0000FF);//Set the location and size of the watermark image $marge_right = $marge _bottom = ten; $sx = Imagesx ($stamp); $sy = Imagesy ($stamp);//combine watermarks and images with 50% transparency Imagecopymerge ($im, $stamp, Imagesx ($im)-$sx-$marge _right, Imagesy ($im)-$sy-$marge _bottom, 0, 0, Imagesx ($stamp), Imagesy ($stamp), 50);//Save the image to a file and release Put memory imagepng ($im, ' photo_stamp.png '); Imagedestroy ($im);? >

Translucent watermark:

This example uses the Imagecopymerge () function to combine the watermark image with the original image. We can control the transparency of the watermark, which in this case is 50% transparency. In actual use, the use of translucent watermark can not affect the user to view the image under the premise of copyright protection.

Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!

Recommended reading:

PHP using the foreach Transform array steps

PHP double quotes to access array elements how to handle errors

Related Article

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.