Home >Backend Development >PHP Tutorial >Use PHP code to add watermark to images, _PHP tutorial
First find a picture, rename it face.jpeg, and create 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
The effect is as follows:
The above is the entire content of this article, I hope you all like it.