Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Avatar
Force
post 19.07.2007, 10:17:06
Post #1





Grupa: Zarejestrowani
Postów: 55
Pomógł: 6
Dołączył: 17.05.2007

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


Witam.
Napisałem mały program generujący avatara z nickiem usera. Nazwa usera jest pobierana z GETa. Adres tego avatara wygląda tak www.domena.pl/avatar/?user=nick_usera . Jak pobrać nick użytkownika nie wpisując ?user= . Chodzi o to żeby adres wyglądał tak /avatar/nick_usera
Poniżej podaje kod php
  1. <?php
  2. //częsć kodu obazka pochodzi z <a href="http://cakper.ovh.org/avatar.php" target="_blank">http://cakper.ovh.org/avatar.php</a>
  3.  
  4. include_once('funkcje.php');
  5.  
  6. $tlo = $_GET[tlo];
  7. $picname = "brak" . $tlo . ".png";
  8. if ( ($tlo) and (file_exists($picname)) )
  9. {
  10. $pic_name = $picname;
  11. }
  12. else
  13. {
  14. $nravka = rand('1', '3');
  15. $pic_name = "brak" . $nravka . ".png";
  16. }
  17.  
  18. header("Content-type: image/png");
  19. $user = polskieznaki($_GET['user']); // wywal polskie znaki
  20. $im = imagecreatefrompng($pic_name);
  21. $user_width = imagettfbbox(9, 0, "tahoma.ttf", $user);
  22. $x_value = (200 - ($user_width[2] + 104));
  23.  
  24. //kolor biały dla 2 a czarny dla reszty
  25.  
  26. if ( ($nravka == '2') || ($tlo == '2') )
  27. {
  28. $color = imagecolorallocate($im, 255, 255, 255);
  29. }
  30. else
  31. {
  32. $color = imagecolorallocate($im, 0, 0, 0);
  33. }
  34. imagettftext($im, 9, 0, $x_value, 96, $color, "tahoma.ttf", $user);
  35. imagepng($im);
  36. imagedestroy($im);
  37.  
  38. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
kossa
post 19.07.2007, 12:12:10
Post #2





Grupa: Zarejestrowani
Postów: 1 165
Pomógł: 9
Dołączył: 9.04.2002
Skąd: Toruń

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


mod_rewrite

Łukasz


--------------------
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: 31.07.2025 - 07:44