note 69511 rejected from function.iconv by bobby
| From: | bobby@php.net | Date: | Fri, 08 Sep 2006 14:23:13 +0000 |
| Subject: | note 69511 rejected from function.iconv by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116906@lists.php.net to get a copy of this message | ||
Note Submitter: hatem at softwarelab dot net
----
hi,
I need to convert arabic text to an Image some guys told me to use Imagettftext and Iconv
it did not worked acuratly because of the following
the arabic letters appear in revers order and not in the format I entered it in
(letters in arabic language must be joined in somehow it not just simple like english language so
the same letter have different shapes if it were in the start of the word and different view if
it's in middle of the word and a 3rd view if it were in the end of the word)
unfortunatley the text box I wrote this message in do the same
so I need a converter for arabic words in the right format from charset windows-1256 to charset-
utf-8
in a sequence where word arabic appears as it's viewed
can any body help in that
thanks in advance
please consider the following code and send me the correction:
<?php
// Set the content-type
header("Content-type: image/png");
// Create the image
$im = imagecreatetruecolor(400, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text =iconv("windows-1256", "UTF-8", ØØ§ØªÙ
");
// Replace path by your own font path
$font = 'tradbdo.ttf';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>