Php Image creation frm unicode

images php coding issues or problems here.

Moderators: macek, egami, gesf

mtpillai
New php-forum User
New php-forum User
Posts: 1
Joined: Thu Mar 15, 2012 3:38 am

Php Image creation frm unicode

Postby mtpillai » Thu Mar 15, 2012 3:47 am

Dear all

My requirement is , i want to convert the english to Indian local language(say Kannada)
I am able to do the same by using the free online site.
i tried the following

Code: Select all

Good  Morning =>i got the result as " Gಊಡ್  ಂಒರ್ನಿನ್ಗ್   "
the Equivalent HTML text is "  ಗೂಡ್ ಮೊರ್ನಿನ್ಗ್ "


Now my requirement is to convert the result(kannada) font to image.
i tried the following

Code: Select all

 header('Content-type: image/png');
$text =  htmlspecialchars_decode($_POST['html_text'],ENT_NOQUOTES);
$im = imagecreate(1000, 100);
// White background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
// Write the string at the top left
imagestring($im, 5, 0, 0, $text, $textcolor);

// Output the image
imagepng($im);
imagedestroy($im); 

But the result shows some other squares. instead if i hard code the $text ="Hai" am getting the imagea as "hai".
so how to convert unicoded string to image using php

Please do help
Thanks in advance
[MP]

Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 2 guests