Mam problem, otoz nie wiem jak moge w prosty sposob wyswietlic napis generowany przez php na gotowym obrazku. Zalozmy, ze mam zdjecie i chce, aby na dole php wygenerowal napis: "tutaj fajny napis". Do tworzenie tla i na nim tekstu urzywam:
<?php // Set the content-type // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); $lol = imagecolorallocate($im, 59, 230, 51); imagefilledrectangle($im, 0, 0, 399, 29, $lol); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'fonts/arial.ttf'; // Add some shadow to the text //imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?>
I teraz pytanie, w jaki sposob zamiast tworzenie tla php stworzyl tekst na gotowym obrazu?
Dziekuje za odpowiedz i pozdrawiam