Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> ttftext nie generuje tekstu
minimal2
post
Post #1





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 11.11.2005
Skąd: from Hel ;)

Ostrzeżenie: (0%)
-----


Witajcie

mam problem z funkcją ttftext (na local'u działa ok niestety na serwerze (60free.ofv.org) nie generuje tekstu) sad.gif

Oto kod pliku generującego obrazek:
  1. <?php 
  2.  
  3. // Deklaracje zmiennych
  4. $fontDir  = 'fonts/';
  5. $fontFiles = array('verdana.ttf', 'impact.ttf', 'comic.ttf', 'arial.ttf');
  6. $string = $_GET["text"];
  7. $r = $_GET["r"];
  8. $g = $_GET["g"];
  9. $b = $_GET["b"];
  10. $width = strlen($string) * 15 + 10; 
  11. $height = 25; 
  12.  
  13. // Przesłanie nagłówków
  14. header('Content-type: image/'.$imgType); 
  15.  
  16. $img = imagecreate($width, $height); 
  17.  
  18. // Deklaracje kolorów
  19. $back = imagecolorallocate ($img, 255, 255, 255); 
  20. $font = imagecolorallocate ($img, $r, $g, $b); 
  21. $dots = imagecolorallocate ($img, rand(, 255), rand(, 255), rand(, 255)); 
  22.  
  23. // Generator plam
  24. $pts = array(); 
  25.  
  26. for($i = 0; $i < round($width / 1.5); $i++) 
  27. { 
  28.  $x = rand(0, $width); 
  29.  $y = rand(0, $height); 
  30.  
  31.  if(!in_array($x.'_'.$y, $pts)) 
  32.  { 
  33. imageellipse($img, $x, $y, rand(2, 4), rand(3, 6), $dots); 
  34. $pts[] = $x.'_'.$y; 
  35.  } 
  36.  else 
  37.  { 
  38. $i--; 
  39.  } 
  40. } 
  41.  
  42. // Generator textu
  43. for($i = 0; $i < strlen($string); $i++) 
  44. { 
  45.  imagettftext($img, rand(14, 16), rand(-10, 10), rand(3, 5) + $i * 15, 20 + rand(-3, 3), $font, $fontDir.'/'.$fontFiles[rand(0, count($fontFiles) - 1)], $string{$i}); 
  46. } 
  47.  
  48. imagecolortransparent ($img, $back);
  49.  
  50. // Wysłanie i zniszczenie obrazka
  51. imagepng($img);
  52. imagepng($img, "email.png"); 
  53. imagedestroy($img); 
  54.  
  55. ?>


Live demo: http://minimal2.ovh.org/index.php (efekt widoczny po wypełnieniu forumlarza)
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 22.08.2025 - 04:52