Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] GD imagettftext - litery nakładają się na siebie
3miel
post
Post #1





Grupa: Zarejestrowani
Postów: 203
Pomógł: 0
Dołączył: 10.06.2004
Skąd: Gliwice

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


Witam,

mam problem z tą funkcją z biblioteki GD, gdy generuje napis z czcionką Monotype Corsiva to litery czasami się nakładają na siebie (tzn. tło z litery następnej zasłania poprzednią, a że jest ono (to tło) niewidoczne to tak jak by usuwa kawałek poprzedniej literki), tu możecie zobaczyć co mam na myśli:
http://bio-relax.com.pl/images_podstrony/header_16_pl.png
http://bio-relax.com.pl/images_podstrony/header_12_pl.png
http://bio-relax.com.pl/images_podstrony/header_13_pl.png

kod wygląda tak:
  1. <?php
  2. // Create the image
  3. $im = imagecreatetruecolor($text_width, $mnoznik_height*$text_height);
  4. imagealphablending($im, false);
  5.  
  6. // Create some colors
  7. $white = imagecolorallocate($im, 255, 255, 255);
  8. $tlo = imagecolorallocatealpha($im, 255, 255, 255, 127);
  9. $text_color = imagecolorallocate($im, $color['r'], $color['g'], $color['b']);
  10. imagefilledrectangle($im, 0, 0, $text_width, $mnoznik_height*$text_height, $tlo);
  11.  
  12. // Add the text
  13. imagettftext($im, $size, $angle, 0, $text_height, $text_color, $font, $text);
  14.  
  15. // Using imagepng() results in clearer text compared with imagejpeg()
  16. @imagesavealpha($im, true);
  17. @imagepng($im, $dir.$name.'.png');
  18. @imagedestroy($im);
  19. ?>


Czy jest jakiś sposób żeby wyeliminować te artefakty?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
sebastian.rozmus
post
Post #2





Grupa: Zarejestrowani
Postów: 48
Pomógł: 12
Dołączył: 7.03.2012

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


Przed wyświetleniem tekstu dodaj:

  1. imagealphablending($im, true);


Powinno pomóc (IMG:style_emoticons/default/wink.gif)

Ten post edytował sebastian.rozmus 10.04.2012, 23:49:48
Go to the top of the page
+Quote Post
3miel
post
Post #3





Grupa: Zarejestrowani
Postów: 203
Pomógł: 0
Dołączył: 10.06.2004
Skąd: Gliwice

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


Tak, dzięki wielkie na prawdę bardzo mi pomogłeś.

Pozdrawiam
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 23.08.2025 - 01:14