$dst _path = ' https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=1597468794,3856954595&fm=80&w=179&h=119 &img. JPEG '; Create an instance of the picture $dst = Imagecreatefromstring (file_get_contents ($DST _path)); $name = ' Xiao Qiang June '; $phone = "13161884078";//Text $font = './adobeheitistd-regular.otf ';//font $black = Imagecolorallocate ($DST, 0x00, 0x00, 0x00);//font color//parameter for picture, size, rotation angle, pixel position, Font color, text font, watermark text imagefttext ($DST, 0, $black, $font, $name);//Output Picture list ($dst _w, $dst _h, $dst _type) = Getimagesi Ze ($dst _path), switch ($dst _type) {case 1://gifheader (' content-type:image/gif '), Imagegif ($DST, "./". $phone. ". GIF "); break;case 2://jpgheader (' content-type:image/jpeg '); imagejpeg ($DST,"./". $phone.". JPEG "), Break;case 3://pngheader (' content-type:image/png '), Imagepng ($DST,"./". $phone.". PNG "); break;default:break;} Imagedestroy ($DST);
How to add watermark to PHP images