1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| $text = 'Un texte un / peu trop long';
$text2 = 'Un texte un / peu trop long';
$fontfile = "sys/Mohave-MediumItalic.otf";
$im = imagecreatefromjpeg('nolive.jpg');
$white = imagecolorallocate($im, 255, 255, 255);
$i_width = 400;
$i_height = 400;
$img = 'NOLIVE_U18400.jpg'; // image source
$img3 = 'NOLIVE_U18400-3.jpg'; // image qui sera enregistrée
$font_size = 14; // Taille de la police.
$string_size = ImageFtBbox($font_size, 0, $fontfile, $text, array("linespacing" => 1)); // On aligne à droite le texte de gauche (contre le séparateur vert)
$s_width = $string_size[4];
$s_height = $string_size[5];
ImageFtText($im, $font_size, 0, $i_width - $s_width - 220, 135, $white, $fontfile, $text, array("linespacing" => 1));
imagettftext($im, $font_size, 0, 220, 135, $white, $fontfile, $text2);
ImagePNG ($im, $img3, 9);
echo 'image = <img src="NOLIVE_U18400-3.jpg">';
ImageDestroy ($im); |
Partager