PHP 图片生成文字

时间:2023-02-10 22:33:31
$dst_path = './1.png';
$font_file = './ADOBEHEITISTD-REGULAR (V5.010).OTF';
$img_bg = imagecreatefrompng($dst_path); //打开图片,
$bg_width = imagesx($img_bg);
$clr = ImageColorAllocate($img_bg, 0xFF,0xFF,0xFF);//这个值手册说必须通过create 图片才能写

imagettftext($img_bg, 20, 0, 90, 150, 255, $font_file, '669');//255 为颜色标识符

// HTTP/1.0
header('Pragma: no-cache');
header('Content-type: image/png');
imagepng($img_bg);
imagedestroy($img_bg);