Analysis on PHP watermarking technology _ PHP Tutorial

Source: Internet
Author: User
Analysis of PHP watermarking technology. I have never been familiar with PHP object processing. I used to find a manual when I was using it. Someone asked a question about the watermark at the phpchina Forum today. I just want to learn about it. I have never been familiar with PHP object processing, I used to find the manual only when I used it. Today, someone asked questions about watermarks at the phpchina forum. I just want to learn about them, so I studied how to implement image watermarks in PHP.

Find the manual and find that the GD library of PHP is really powerful and easy to implement the watermark function. The watermark is actually merging two images. Watermark text can also be implemented.

I provide simple learning examples, which are mainly used to understand the principles.

Two images: 1、photo.jpg watermark image

2、source.gif watermark image


The following code implements the watermark function.

Header ("Content-type: image/jpeg ");
$ Filename = '../src/images/photo.jpg ';
$ Im = imagecreatefromjpeg ($ filename );
$ S = imagecreatefromgif ('../src/images/source.gif ');
Imagecopymerge ($ im, $ s, 0, 0, 0, 132,27, 60 );
Imagejpeg ($ im );

The watermark result is as follows:


You can implement the detailed functions by yourself.

Bytes. Someone asked a question about the watermark at the phpchina Forum today. I just want to learn about it...

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.