时间:2021-07-01 10:21:17 帮助过:28人阅读
$pic=imagecreate(250,30);
$black=imagecolorallocate($pic,0,0,0);
$white=imagecolorallocate($pic,255,255,255);
$font="C://WINDOWS//Fonts//simhei.ttf"; //这里的路进需要注意下,必须是字符的路径
$str ='php'.iconv('gb2312','utf-8','面对对象')." www.phpobject.net";
imagettftext($pic,10,0,10,20,$white,$font,$str);
$pic=imagecreate(250,30);
$black=imagecolorallocate($pic,0,0,0);
$white=imagecolorallocate($pic,255,255,255);
$font="C://WINDOWS//Fonts//simhei.ttf";
$str ='php'.iconv('gb2312','utf-8','面对对象')." www.phpobject.net";
imagettftext($pic,10,0,10,20,$white,$font,$str);
header("Content-type: image/jpeg");
$filename='../src/images/photo.jpg';
$im=imagecreatefromjpeg($filename);
imagecopymerge($im,$pic,0,0,0,0,250,30,50);
imagejpeg($im);
?>