0

I have this code, but my problem is that the starting point from left to right as in English, and I got no clue how to make it RTL

here's my code:

$test = "بسم الله الرحمن الرحيم";

$test = $Arabic->utf8Glyphs($test);

$test= $test;

$angle = 0;

$font_size =40;

// Get image dimensions
$width = imagesx($jpg_image);

$height = imagesy($jpg_image);

// Get center coordinates of image

$centerX = $width / 2;

$centerY = $height / 2;

// Get size of text
list($left, $bottom, $right, , , $top) = imageftbbox($font_size, $angle, $font_path, $test);

$left_offset = ($right - $left) / 2;

$top_offset = ($bottom - $top) / 2;

$x = $centerX - $left_offset;

$y = $centerY - $top_offset;


imagettftext($jpg_image, $font_size, $angle, $x + 950, 665, $color, $font_path, $test);
  • Check this out ... https://stackoverflow.com/questions/46684059/imagettftext-and-arabic-language-how-can-i-write-in-rtl-mode – Ahmed Saleh Aug 23 '20 at 12:01
  • I've checked the before asking, it's not the same as my question. I don't just want to align it to right, but my code is writing the words starting from the left as in English – user2373804 Aug 23 '20 at 12:12

0 Answers0