05-05-2006, 14:57
|
|
|
חבר מתאריך: 12.08.05
הודעות: 883
|
|
קוד שמתקן עברית בGD
טוב שמעו...
מצאתי קוד שהופך את העברית בGD ליוניקוד...
קוד:
function hebgd($s)
{
$s = hebrev($s);
$l = strlen($s);
$o = '';
for($i = 0; $i < $l; $i++)
{
$c = ord($s[$i]);
$o .= $c>223&&$c<251?'&#'.(1264+$c).';':chr($c);
}
return $o;
}
$string = $_POST["name"];
$string = hebgd($string);
הקוד הוא של צחי(php) מפורום phpbbheb.com!
http://www.phpbbheb.com/viewtopic.php?t=4626
אחרי שהוספתי את הקוד הזה אז העברית הופכת למין מספרים כאלה...
השאלה שלי היא איך אני הופך את המספרים לעברית...
זה הקוד המלא שלי
קוד:
function hebgd($s)
{
$s = hebrev($s);
$l = strlen($s);
$o = '';
for($i = 0; $i < $l; $i++)
{
$c = ord($s[$i]);
$o .= $c>223&&$c<251?'&#'.(1264+$c).';':chr($c);
}
return $o;
}
$string = $_POST["name"];
$font_number = 4;
$text = hebgd($string);
$width = 2 * strlen($text) * imagefontwidth($font_nember);
$height = 3 * imagefontheight($font_number);
$image = imagecreatefromjpeg ("s.jpeg");
$back_color = imageColorAllocate($image, 22, 200, 255);
$drawing_color = imageColorAllocate($image, 0, 0, 0);
$x_position = ($width - (strlen($text) * imagefontwidth($font_number))) / 2;
$y_position = ($height - imagefontheight($font_number)) / 2;
imagestring($image, $font_number, $x_position, $y_position, $text, $drawing_color);
header('content-type: image/jpeg');
imagejpeg($image);
imageDestory($image);
תודה למי שיעזור!
|