Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Tekst na obrazie
Kamil9132
post 6.03.2011, 14:18:00
Post #1





Grupa: Zarejestrowani
Postów: 210
Pomógł: 0
Dołączył: 7.11.2010

Ostrzeżenie: (10%)
X----


Witam
Mam taki kod:
  1. srand((float) microtime() * 10000000);
  2. $wejscie = array ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "r", "s", "t", "w", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",);
  3. $losowe_klucze = array_rand ($wejscie, 5);
  4. $pis = $wejscie[$losowe_klucze[0]]. "\n" .
  5. $wejscie[$losowe_klucze[1]] . "\n" .
  6. $wejscie[$losowe_klucze[2]] . "\n" .
  7. $wejscie[$losowe_klucze[3]] . "\n" .
  8. $wejscie[$losowe_klucze[4]];
  9.  
  10.  
  11. // Create the image
  12. $im = imagecreatetruecolor(130, 30);
  13.  
  14. // Create some colors
  15. $white = imagecolorallocate($im, 255, 127, 80);
  16. $grey = imagecolorallocate($im, 128, 128, 128);
  17. $black = imagecolorallocate($im, 255, 255, 255);
  18. imagefilledrectangle($im, 0, 0, 399, 29, $white);
  19.  
  20. $pis = '';
  21. foreach($losowe_klucze as $klucz){
  22. $pis .= $wejscie[$klucz];
  23. }
  24.  
  25. // The text to draw
  26. $text = $pis;
  27. $zapis = mktime();
  28. $zapisz = $zapis.".png";
  29. $otworz = "./indetyfikatory/".$zapis.".png";
  30. $czas = $zapis - 600;
  31. // Replace path by your own font path
  32. $font = 'arial.ttf';
  33.  
  34. // Add some shadow to the text
  35. imagettftext($im, 20, -5, 11, 21, $grey, $font, $text);
  36.  
  37. // Add the text
  38. imagettftext($im, 20, -5, 10, 20, $black, $font, $text);
  39.  
  40. // Using imagepng() results in clearer text compared with imagejpeg()
  41. imagepng($im, "./indetyfikatory/$zapisz");
  42. imagedestroy($im);


Czemu na obrazie nie ma tekstu questionmark.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 12.06.2025 - 13:27