Jump to content

Text to image


technomyst1

Recommended Posts

Hi,

I am using  php imagettftext() function for converting bengali unicode text to image. but the problem is in the output image i am getting the bengali characters in wrong order. can anybody help? my code is :

 

 

 

header('Content-type: image/gif');

 

mb_language('uni');

mb_internal_encoding('UTF-8');

 

$text = $_GET['text'];

 

$font = 'Mohua.ttf';

 

 

 

$im = imagecreatetruecolor(125,25);

$white = imagecolorallocate($im, 255, 255, 255);

$black = imagecolorallocate($im, 0, 0, 0);

 

 

imagefilledrectangle($im, 0, 0, 125, 25, $white);

 

 

imagettftext($im, 12, 0, 10, 20, $black, $font, $text);

imagegif($im);

imagedestroy($im);

 

Link to comment
https://forums.phpfreaks.com/topic/239563-text-to-image/
Share on other sites

wrong order means in the attached image the 2nd character should come in first and the 6th character should come at 5th position.

 

this type of character disorder problem also happened when we try to see bengali unicode websites. to view the characters in correct order we have to  select in windows OS-- control panel->regional and language option -> install files for complex script and right to left languages . so this is the solution for viewing unicode bengali in correct order in web browser.

 

but for converting text to image what should i do.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/239563-text-to-image/#findComment-1230705
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.