السلام عليكم
لدي استفسار عن كود لتحويل النص الى صورة ، انشأته بهذا الشكل :
require('./I18N/Arabic.php');
$Arabic = new I18N_Arabic('Glyphs');
$font = './Alhurra Regular.ttf';
$text = $Arabic->utf8Glyphs(htmlspecialchars($_GET["text"]) );
$im = imagecreatefrompng('bg3.png');
// 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, 0, 0, $white);
// Add the text
imagettftext($im, 30, 0, 0,300, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im, "./text-img/output_arabic_image.png");
$remoteImage = "./text-img/output_arabic_image.png";
$imginfo = getimagesize($remoteImage);
header("Content-type: {$imginfo['mime']}");
readfile($remoteImage);
النتيجة تظهر هكذا
اريد ان يأتي النص داخل المربع الاحمر
شكرا على المساعدة
التعليقات