I have never been very familiar with PHP object processing. In the past, I only looked for manuals when using it. Today someone asked about watermarking on the phpchina forum. I happened to want to learn about it, so I studied the implementation of image watermarking in PHP.
Looking for the manual, I found that PHP’s GD library is really powerful and easy to implement the watermark function. Watermarking is actually merging two images. The same can be achieved for watermark text.
I provide simple learning examples, very simple, mainly to understand the principles.
Two pictures: 1. Photo.jpg watermarked picture
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);
true