Mam taki kod:

  1. <?
  2. header('Content-type: image/png');
  3. // Set the content-type
  4. // Set the enviroment variable for GD
  5. // Create the image
  6. $im = imagecreatetruecolor(400, 30);
  7.  
  8. // Create some colors
  9. $white = imagecolorallocate($im, 255, 255, 255);
  10. $grey = imagecolorallocate($im, 128, 128, 128);
  11. $black = imagecolorallocate($im, 0, 0, 0);
  12. imagefilledrectangle($im, 0, 0, 399, 29, $white);
  13.  
  14. // The text to draw
  15. $text = 'Rezerwacja';
  16. // Replace path by your own font path
  17. $font = 'C:/Windows/Fonts/arial.ttf';
  18.  
  19. // Add some shadow to the text
  20. imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
  21.  
  22. // Add the text
  23. imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
  24.  
  25. imagecolortransparent($im);
  26.  
  27. // Using imagepng() results in clearer text compared with imagejpeg()
  28. imagepng($im);
  29. imagedestroy($im);
  30.  
  31. ?>

napis wyświetla się ok
ale chce żeby był pokazywany na przezroczystym tle a nie białym, patrzałem że są klasy różne, ale nie udało mi się uzyskać efektu, zawsze musiało być zapisane albo coś innego.

rozwiązałem problem, teraz mam jeszcze jeden gry wyświetlam napis zamiast tekstu pojawiają się same kwadraty sad.gif
  1. <?
  2. header('Content-type: image/png');
  3. // Set the content-type
  4. // Set the enviroment variable for GD
  5. // Create the image
  6. $im = imagecreatetruecolor(400, 30);
  7.  
  8. // Create some colors
  9. $white = imagecolorallocate($im, 255, 255, 255);
  10. $grey = imagecolorallocate($im, 128, 128, 128);
  11. $black = imagecolorallocate($im, 0, 0, 0);
  12. imagefilledrectangle($im, 0, 0, 399, 29, $white);
  13.  
  14.  
  15.  
  16.  
  17. imagealphablending($im, false);
  18.  
  19. // ustawiamy kolor alfa
  20. $trans = imagecolorallocatealpha($im, 128, 128, 128,127);
  21.  
  22. //wypelniamy kolorem alfa
  23. imagefill($im, 0, 0, $trans);
  24.  
  25. //zapisujemy alfa
  26. imagesavealpha($im, true);
  27. // wlaczamy alfa:)
  28. imagealphablending($im, true);
  29.  
  30.  
  31.  
  32. // The text to draw
  33. $text = 'Rezerwacja';
  34. // Replace path by your own font path
  35. $font = 'C:/Windows/Fonts/Radagund.ttf';
  36.  
  37. // Add some shadow to the text
  38. imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
  39.  
  40. // Add the text
  41. imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
  42.  
  43.  
  44.  
  45. // Using imagepng() results in clearer text compared with imagejpeg()
  46. imagepng($im);
  47. imagedestroy($im);
  48.  
  49. ?>


może coś z kodowaniem czcionki Radagund?

pomoże ktoś? smile.gif