PHP object processing has been not very familiar with, used to be used in the time to find the manual. Today, someone in the Phpchina forum asked about the watermark of the relevant issues, just I want to learn, so the next PHP implementation of the image watermark implementation.
Find the manual, found that the PHP GD library is really powerful and easy to implement the watermark function. The watermark is actually merging two images. The same can be achieved for watermark text.
I provide simple learning examples, very simple, mainly to understand the principle.
Two pictures: 1, photo.jpg watermark picture
2. Source.gif Watermark Image
The following code mainly 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,0,132,27,60);
Imagejpeg ($im);
The watermark results are as follows:
Hehe, the detailed function you can realize by yourself.
The above describes the Pimchanok Leuwisetpaiboon analysis of PHP watermark technology, including the Pimchanok Leuwisetpaiboon aspects of the content, I hope that the PHP tutorial interested in a friend helpful.