Ich möchte der Text ist "Text Align Right".PHP: imagetttext 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);
Sie wissen wie? Weil ich es nicht verstehe. Ich google schon viel. Ihr müsst wissen, dass ich nicht wirklich in PHP bin, deshalb brauche ich Hilfe. Wenn Sie Fragen haben, fragen Sie bitte!
gd legt nur den Text, wo Sie es sagen. es hat keine "nach links ausrichten" oder "nach rechts ausrichten". Sie müssen das selbst implementieren: http://php.net/manual/en/function.imagettfbbox.php –
@MarcB ok, und wie? – ZarneXxX
lesen Sie den Link. lernen Sie, die Werkzeuge zu benutzen, die Sie bekommen. Entkomme der Denkweise von "find function' do_exactly_what_I_need() '" und gehe in die Denkweise von 'use(); simple_tools(); unter der Voraussetzung(); erreichen(); complicated_things(); ' –