Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Obramowanie tekstu w GD
brzanek
post 8.11.2018, 08:22:03
Post #1





Grupa: Zarejestrowani
Postów: 427
Pomógł: 0
Dołączył: 8.11.2012

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


Witam mam kod w bibliotece GD i chciałbym uzyskać obramowanie tekstu w kolorze czarnym. Czy w tej funkcji jest możliwe?
Tak wygląda kod
  1. <?
  2. include('db.php');
  3. {
  4. $t=time();
  5. // Create a destination
  6. $dest = "images_new/".date("Y_m_d_H").".jpg";
  7. // Get contents from original spot
  8. $im = imagecreatefromjpeg("images/mapa_new2018a1.jpg");
  9.  
  10. $white = imagecolorallocate($im, 255, 255, 255);
  11. $red = imagecolorallocate($im, 255, 0, 0);
  12.  
  13. // Save to disk in the new spot and name
  14.  
  15. $dzien["Monday"] = "Poniedziałek";
  16. $dzien["Tuesday"] = "Wtorek";
  17. $dzien["Wednesday"] = "Środa";
  18. $dzien["Thursday"] = "Czwartek";
  19. $dzien["Friday"] = "Piątek";
  20. $dzien["Saturday"] = "Sobota";
  21. $dzien["Sunday"] = "Niedziela";
  22.  
  23. $result = $mysqli->query("SELECT * FROM dane WHERE id_miasto =1 ORDER BY id DESC LIMIT 1");
  24. while ( $row = mysqli_fetch_array($result) ) {
  25. $text = 'Temperatura powietrza na wysokości 2m. '.$row['czas'].' '.$row['godzina'].'';
  26. $tempmax = ''.$row['temp'].'şC';
  27. }
  28. $result = $mysqli->query("SELECT * FROM dane WHERE id_miasto =19 ORDER BY id DESC LIMIT 1");
  29. while ( $row = mysqli_fetch_array($result) ) {
  30. $tempmax1 = ''.$row['temp'].'şC';
  31. }
  32. // Replace path by your own font path
  33. $font = 'arial.ttf';
  34. imagettftext($im, 34, 0, 14, 69, $white, $font, $text);
  35. imagettftext($im, 33, 0, 986, 227, $red, $font, $tempmax); //darłowo
  36. imagettftext($im, 33, 0, 193, 891, $red, $font, $tempmax1); //szczecin
  37.  
  38. imagejpeg($im,$dest, 100);
  39. // Destroy image
  40. imagedestroy($im);
  41. }
  42. ?>


Włączone funkcje GD na serwerze
  1. array(12) { ["GD Version"]=> string(26) "bundled (2.1.0 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPEG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(true) ["XBM Support"]=> bool(true) ["WebP Support"]=> bool(false) ["JIS-mapped Japanese Font Support"]=> bool(false) }


Ten post edytował brzanek 8.11.2018, 08:22:50
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
trueblue
post 8.11.2018, 08:37:32
Post #2





Grupa: Zarejestrowani
Postów: 6 761
Pomógł: 1822
Dołączył: 11.03.2014

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


Używasz czasem Google?
https://www.google.com/search?q=php%20gd%20text%20shadow


--------------------
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 Wersja Lo-Fi Aktualny czas: 26.04.2024 - 21:13