Home  >  Article  >  Backend Development  >  A brief analysis of PHP watermark technology_PHP tutorial

A brief analysis of PHP watermark technology_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:57:00864browse

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);

imagejpeg ($im);


The watermark results are as follows:



Haha, you can implement the detailed functions yourself.


点击在新窗口中浏览此图片
http://www.bkjia.com/PHPjc/317917.html

www.bkjia.com

true

TechArticleI have never been very familiar with PHP object processing. In the past, I only looked for manuals when using it. Today someone asked about watermarks on the phpchina forum. I just wanted to learn about it, so...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn