Home >Backend Development >PHP Tutorial >Add watermark to images using PHP code_PHP tutorial
This article mainly introduces the relevant information about using PHP code to add watermark to pictures. Friends who need it can refer to it
First find a picture, rename it face.jpeg, and create watermark.php:
?
2 4 56 |
/** * Created by PhpStorm. * User: Administrator * Date: 2015/6/29 * Time: 22:27 */ $img = imagecreatefromjpeg('face.jpeg');//Create image based on existing JPG header('Content-type:image/jpeg');//Set mime type imagestring($img,5,5,5,'Vito-L',imagecolorallocate($img,255,0,0));//Generate watermark, imagestring(picture, font, position x, position y, string, color) imagejpeg($img);//Output image //The upper left corner of the entire image is 0, 0 |