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

Upvotes: 1

Views: 1693

Answers (1)

LSerni
LSerni

Reputation: 57388

There are issues with ImageTTFText and Unicode.

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

Upvotes: 1

Related Questions