Vorrei creare un'immagine con del testo, i linguaggi LTR sembrano funzionare bene, ma quando lo si prova in arabo, semplicemente, non ha funzionato , vedere il muggito screenshot dove traggo 3 stringhe di testo con il codice testo presentatoScrivi testo RTL (arabo) per immagini con PHP
Ecco il mio codice di prova (con alcuni commenti):
// Create a 300*300 image
$im = imagecreate(300, 300);
// Yellow transparent background and blue text
$bg = imagecolorallocatealpha($im, 255, 255, 0, 45);
$textcolor = imagecolorallocate($im, 0, 0, 255);
// Write an LTR string
imagestring($im, 5, 250, 100, 'test', $textcolor);
$font = 'DroidKufi-Regular.ttf'; // specify the fonts file
$text = "تجربة";
// Add the text
imagettftext($im, 10, 0, 10, 20, $textcolor, $font, $text);
// set a red text color
$textcolor = imagecolorallocate($im, 255, 0, 0);
// strrev doesn't seem to solve the problem
$text = strrev($text);
// add the text
imagettftext($im, 10, 0, 30, 250, $textcolor, $font, $text);
imagefilledrectangle ($im, 0, 0, 1, 1, $bg);
// Output the image
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
Hai provato la [soluzione qui] (http://www.php.net //manual/en/function.imagettftext.php#91028) sto assumendo? O [questo forse?] (Http://stackoverflow.com/questions/2444015/right-align-text-in-an-image-with-imagettftext-php) .. forse non l'hai fatto, forse hai solo provato [questo?] (http://forums.phpfreaks.com/topic/44370-solved-make-text-string-read-from-right-to-left-in-imagettftext-function/) – Ohgodwhy
Sì hai ragione , ma non penso che questo http://stackoverflow.com/questions/2444015/right-align-text-in-an-image-with-imagettftext-php mi aiuterà, ma ci provo , grazie per la rapida risposta :) –
In realtà quella soluzione non punta vicino al mio problema –