ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ public function test(){ header('Content-type: image/png'); $text = "كۆپ كۆرۈلگەن ئەڭ يېڭى كىنولار"; // $text = Uyghur_Convert_Gd_v3::convert_to_ps2($text, true); $font = 16; // 获取文本尺寸 $font_ttf = '/Static/Fonts/UKIJEKRAN.ttf'; $size = imagettfbbox($font, 0, $font_ttf, $text); $width = abs($size[2] - $size[0]); $height = abs($size[5] - $size[3]); // 创建画布 $image = imagecreatetruecolor($width + 40, $height + 15); // 添加背景 $bgColor = imagecolorallocate($image, 255, 255, 255); imagefill($image, 0, 0, $bgColor); // 添加文本 $textColor = imagecolorallocate($image, 255, 97, 70); imagettftext($image, $font, 0, 0, $height, $textColor, $font_ttf, $text); // 添加icon $icon = "https://dilkan.ulinix.cn/Static/mob/icon/bg-left.png.png"; // 替换为你的icon路径 $iconImg = imagecreatefrompng($icon); $icon = imagescale($iconImg, 25, 20); imagecopy($image, $icon, $width + 7, 8, 0, 0, 25, 20); imagepng($image); imagedestroy($image); } ~~~ ![](https://img.kancloud.cn/3e/7f/3e7f770cbf1d21bdf7c5f867d029b34c_297x54.png)