/ ** * @param $ str need to play text watermark * @param int $ size text size @param int $ red text color rgb r * * @param int $ G GREE text color rgb * @param int $ Blue text B color RGB * @param string $ path generated after the image path * @author Ningjia Bing * / function Watermark (STR $, $ size = 48, Red = $ 150, $ GREE = 150, Blue = $ 150, $ = path '/ the Uploads / the FS / photo_stamp.png') { $ imagecreatefrompng IM = (the STATIC __ __ '/ images / lucency.png');. // introducing transparent image $ font = __STATIC __ "/ fonts / msyh.ttf".; // font files introduced // create a watermark image manually from GD $ = Stamp as imagecreatetruecolor (2480, 3508); // set the font background imagefilledrectangle ($ stamp, 0, 0 , 2480, 3508, 0xFFFFFF); Color = imagecolorallocate $ ($ Stamp, Red $, $ GREE, $ Blue); // played full screen for (I $ =. 1; $ I <25; $ I ++) { imagefttext (Stamp $, $ size, 50,0,150 * I $, $ Color, $ font, STR $); for ($ J =. 1; $ J <15; $ J ++) { imagefttext ($ Stamp, $ size, 50,200 * $ J, 150 * $ I, $ Color, $ font, $ STR); } } // combined with 50% transparency watermark and image imagecopymerge ($ IM, $ Stamp, 0, 0, 0, 0, imagesx ($ Stamp), imagesy ($ Stamp), 20); // save the image to a file, and frees up memory watermark imagepng ($ im , $ path); imagedestroy ($ IM); }