使用它向图像添加文本(从PHP for Kids复制)
<?php//Set the Content Typeheader('Content-type: image/jpeg');// Create Image From Existing File$jpg_image = imagecreatefromjpeg('sunset.jpg');// Allocate A Color For The Text$white = imagecolorallocate($jpg_image, 255, 255, 255);// Set Path to Font File$font_path = 'font.TTF';// Set Text to Be Printed On Image$text = "This is a sunset!";// Print Text On Imageimagettftext($jpg_image, 25, 0, 75, 300, $white, $font_path, $text);// Send Image to Browserimagejpeg($jpg_image);// Clear Memoryimagedestroy($jpg_image);?>


