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...