开启
extension = php_gd2.dll
$source = imagecreatefrompng($filepath) or die('error');//从路径创建源图
$newimg = imagecreatetruecolor(3300, 2550);//设置修改图颜色
imagecopy($newimg, $source, 0, 0, 0, 0, 3300, 2550);//从源图创建修改图, 不能直接用源图修改,会出错</span>
$textcolor = imagecolorallocate($newimg, 0, 0, 0);//设置文字颜色(img,r,g,b)
imagettftext($newimg, 20, 0, x, y, $textcolor, $ttf_file_path, 'sometext');//(img,font-size,angle,x,y,color,font_file,string)
header("Content-Type: image/png");
imagepng($newimg);
imagedestroy($newimg);//刷新缓冲区
imagedestroy($source);