Home  >  Article  >  Backend Development  >  用PHP代码给图片加水印_PHP教程

用PHP代码给图片加水印_PHP教程

WBOY
WBOYOriginal
2016-07-13 09:48:03908browse

用PHP代码给图片加水印

   这篇文章主要介绍了用PHP代码给图片加水印的相关资料,需要的朋友可以参考下

  先找好一张图片,更名为face.jpeg,创建watermark.php:

  ?

1

2

3

4

5

6

7

8

9

10

11

12

/**

* Created by PhpStorm.

* User: Administrator

* Date: 2015/6/29

* Time: 22:27

*/

$img = imagecreatefromjpeg('face.jpeg');//根据已有的JPG创建image

header('Content-type:image/jpeg');//设置mime type

imagestring($img,5,5,5,'Vito-L',imagecolorallocate($img,255,0,0));//生成水印,imagestring(图片,字体,位置x,位置y,字符串,颜色)

imagejpeg($img);//输出图片

//整幅图像的左上角为 0,0

  效果如下:

  以上所述就是本文的全部内容了,希望大家能够喜欢。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1025318.htmlTechArticle用PHP代码给图片加水印 这篇文章主要介绍了用PHP代码给图片加水印的相关资料,需要的朋友可以参考下 先找好一张图片,更名为face.jpeg,创...
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