Я хочу, чтобы текст был «Text Align Right».PHP: imagettftext text align right (RTL)
$url = "#";
$input = @file_get_contents($url) or die('Fehler!');
if(preg_match_all('~<span class="a">\s*(.*?)\s*</span>~si', $input, $item_name));
$image = imagecreatefrompng("bg.png");
imagesavealpha($image, true);
imagealphablending($image, true);
$finalImage = imagecreatetruecolor(800,200);
$font = '../arial.ttf';
$color = imagecolorallocate($finalImage, 0, 0, 0);
$color_time = imagecolorallocate($finalImage, 100, 100, 100);
imagettftext($image, 10, 0, 23, 15, $color, $font, $item_name[1][0]);
imagettftext($image, 10, 0, 22, 33, $color, $font, $item_name[1][1]);
imagettftext($image, 10, 0, 22, 51, $color, $font, $item_name[1][2]);
imagettftext($image, 10, 0, 22, 69, $color, $font, $item_name[1][3]);
imagettftext($image, 10, 0, 22, 87, $color, $font, $item_name[1][4]);
imagettftext($image, 10, 0, 22, 105, $color, $font, $item_name[1][5]);
imagettftext($image, 10, 0, 22, 123, $color, $font, $item_name[1][6]);
imagettftext($image, 10, 0, 22, 141, $color, $font, $item_name[1][7]);
imagettftext($image, 10, 0, 22, 159, $color, $font, $item_name[1][8]);
imagettftext($image, 10, 0, 22, 177, $color, $font, $item_name[1][9]);
imagettftext($image, 10, 0, 22, 195, $color, $font, $item_name[1][10]);
header('Content-type: image/png');
imagepng($image);
Вы знаете, как? Потому что я не понимаю. Я уже много гугл. Вы, ребята, должны знать, что я не очень добрался до PHP, вот почему мне нужна помощь. Если у вас есть вопросы, пожалуйста, спросите!
gd только размещает текст, в котором вы его указываете. он не имеет «выравнивание влево» или «выравнивание вправо». вам нужно реализовать это самостоятельно: http://php.net/manual/en/function.imagettfbbox.php –
@MarcB ok, и как? – ZarneXxX
прочитайте ссылку. научитесь использовать предоставленные вами инструменты. выйти из менталитета «найти функцию' do_exactly_what_I_need() ') и войти в мышление' use(); simple_tools(); предоставлена(); to_accomplish(); complex_things(); ' –