先找好一张图片,更名为face.jpeg,创建watermark.php:
1 <?
php
2 /**
3 * Created by PhpStorm.
4 * User: Administrator
5 * Date: 2015/6/29
6 * Time: 22:27
7 */
8 $img = imagecreatefromjpeg('face.jpeg');
//根据已有的JPG创建image
9 header('Content-type:image/jpeg');
//设置mime type
10 imagestring(
$img,5,5,5,'Vito-L',imagecolorallocate(
$img,255,0,0));
//生成水印,imagestring(图片,字体,位置x,位置y,字符串,颜色)
11 imagejpeg(
$img);
//输出图片
12 //整幅图像的左上角为 0,0
效果如下:
转载于:https://www.cnblogs.com/Vito-L/p/4609143.html
相关资源:JAVA上百实例源码以及开源项目