我正在尝试从印地文unicode文本创建图像。代码工作正常,但问题是我键入了अमित来写入图像但在创建图像后,单词अमित变为अमति。
任何解决方案??? 这是我的代码: -
$text=$_POST["text"];
htextToImg($text);
function htextToImg($text, $image_width=500, $colour = array(0,0,0), $background = array(255,255,255)) {
$font = "ARIALUNI.TTF";
$line_height = 15;
$padding = 15;
$text = wordwrap($text, ($image_width/10));
$lines = explode("\n", $text);
$im = imagecreatetruecolor($image_width,((count($lines) * $line_height))+5);
$white = imagecolorallocate($im, $background[0], $background[1], $background[2]);
imagefilledrectangle($im,0,0,imagesx($im),imagesy($im),$white);
// write the text to image
$color = imagecolorallocatealpha($im, 0, 0, 0, 0);
$size = 13;
$angle = 0;
$x = 5;
$y = 14;
for($l=0;$l<count($lines);$l++)
{
imagettftext($im, $size, $angle, 2, $y, $color, $font, $lines[$l]);
$y =$y+15;
}
imagejpeg($im, 'dir/img.jpg');
}