用PHP代码给图片加水印

yipeiwu_com7年前PHP代码库

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

 <?php
 /**
 * 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

效果如下:

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

相关文章

分享下php5类中三种数据类型的区别

public: 公有类型     在子类中可以通过self::var 来调用 public类型的方法或属性 可以通过parent::method 来调用父类中的方法     在实例中可以...

php中strstr、strrchr、substr、stristr四个函数的区别总结

php中strstr、strrchr、substr、stristr四个函数用法区别: php中strstr strrchr substr stristr这四个字符串操作函数特别让人容易混...

PHP实现断点续传乱序合并文件的方法

本文实例讲述了PHP实现断点续传乱序合并文件的方法。分享给大家供大家参考,具体如下: 分割成多个文件发送,由于网络原因并不上先发就能发接收到。所以我们不能按顺序合并。 分割文件源码前面一...

PHP错误提示It is not safe to rely on the system……的解决方法

在php程序开发中有时会出现类似于这样的警告: PHP Warning: date(): It is not safe to rely on the system's timezone...

php处理文件的小例子(解压缩,删除目录)

复制代码 代码如下:<?php  $dir =   './temp';$desc   =   'tar_tes...