# 图片写字 > 本例需要使用gd库, 判断是否有安装gd库用`gd_info()`函数 ``` header('Content-type: image/jpeg'); $dst = "static/image/auth.jpg"; $source = imagecreatefromjpeg($dst); //设定背景图片 $white = imagecolorallocate($source, 0, 0, 0); //设定字体颜色 imagettftext($source, 80, 0, 825, 2500, $white, 'static/font/yahei.ttf', 'by 剑齿虎'); imagettftext($source, 80, 0, 825, 2673, $white, 'static/font/yahei.ttf', date('Y年m月d日')); imagejpeg($source); imagedestroy($source); exit; ```