简体   繁体   中英

How to convert Unicode Indian language (Malayalam) to Image using PHP

Here is my php code for creating an image with text inside, I used Malayalam language text but PHP generating an image like this "?????"

<?php mb_language('uni'); 
mb_internal_encoding('UTF-8'); 
header('Content-type: image/gif');
$text = 'മലയാളം  ';
$font = 'mlkarthika.ttf';
$im = imagecreatetruecolor(160, 160);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 159, 159, $white);
imagettftext($im, 12, 0, 20, 20, $black, $font, $text);
imagegif($im);
imagedestroy($im);
?>

the font ML_ttkarthika is avalable in unicode font website, please help me

There are issues with ImageTTFText and Unicode.

You may want to look at this: PHP function imagettftext() and unicode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM