Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Help gg stat img
Krizis
post
Post #1





Grupa: Zarejestrowani
Postów: 49
Pomógł: 1
Dołączył: 27.07.2008

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


Moze mi to ktos naprawic i napisac jak to powinno wygladac:
  1. <?php
  2. $gg = getenv(&#092;"QUERY_STRING\");
  3. $plik = fopen (&#092;"http://www.gadu-gadu.pl/users/status.asp?id=$gg&styl=2\", \"r\"); 
  4. $status = fgets($plik, 2);
  5. switch ($status)
  6. {
  7.  case 1:
  8. echo '<img src=\"niedostepny.png\">'; 
  9. break;
  10.  case 2:
  11. echo '<img src=\"dostepny.png\">'; 
  12. break;
  13.  case 3: 
  14. echo '<img src=\"wracam.png\">'; 
  15. break;
  16.  default:
  17. // w razie błędu pokaże się obrazek error.jpg
  18. echo 'Nie dziala!!!';
  19. break;
  20. }
  21. // pobieranie poszczególnych danych
  22. $txt = &#092;"Cos niedziala\";
  23. // Stwórz PNG z obrazka istniejącego
  24. $img = ImageCreateFromPNG(&#092;"gg.png\");
  25.  
  26. // Ustawianie koloru (RGB)
  27. $kolor = ImageColorAllocate($img,30,48,65);
  28.  
  29. // Wyświetlanie danych w sygnaturce (za pomocą tekstu)
  30. ImageString($img,2,10,20,$status,$kolor);
  31.  
  32. // Ostateczne tworzenie obrazka
  33. Header(&#092;"Content-type: image/png\");
  34. ImagePNG($img);
  35.  
  36. fclose($plik);
  37. ?>


Ten post edytował Krizis 29.07.2008, 13:45:32
Go to the top of the page
+Quote Post
ddiceman
post
Post #2





Grupa: Zarejestrowani
Postów: 326
Pomógł: 121
Dołączył: 23.07.2008
Skąd: Wrocław

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


Mieszasz dokument HTML z PNG, potrzebujesz 2 pliki:

status.php
  1. <?php
  2. $gg = getenv("QUERY_STRING");
  3. $plik = fopen ("http://www.gadu-gadu.pl/users/status.asp?id=".$gg."&styl=2", "r"); 
  4. $status = fgets($plik, 2);
  5. switch ($status)
  6. {
  7.  case 1:
  8.  case 2:
  9.  case 3:
  10. echo '<img src="obrazek.php?status='.$status.'">'; 
  11. break;
  12.  default:
  13. // w razie błędu pokaże się obrazek error.jpg
  14. echo '<img src="error.jpg">'; 
  15. break;
  16. }
  17. fclose($plik);
  18. ?>


obrazek.php:
  1. <?php
  2. switch($_GET['status']){
  3. case 1: $status = 'dostepny'; break;
  4. case 2: $status = 'zaraz wracam'; break;
  5. case 3: $status = 'niedostepny'; break;
  6. default: $status = 'error';
  7. }
  8. // Stwórz PNG z obrazka istniejącego
  9. $img = ImageCreateFromPNG("gg.png");
  10.  
  11. // Ustawianie koloru (RGB)
  12. $kolor = ImageColorAllocate($img,30,48,65);
  13.  
  14. // Wyświetlanie danych w sygnaturce (za pomocą tekstu)
  15. ImageString($img,2,10,20,$status,$kolor);
  16.  
  17. // Ostateczne tworzenie obrazka
  18. Header("Content-type: image/png");
  19. ImagePNG($img);
  20. ?>
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 Aktualny czas: 22.08.2025 - 06:58