Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP][GD]Wyświetlanie na grafice
Marcuez
post
Post #1





Grupa: Zarejestrowani
Postów: 98
Pomógł: 1
Dołączył: 7.07.2009
Skąd: Poligon Osielsko

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


  1. <?php
  2. // klasa
  3. include("class_PQ.php");
  4. $pq = PQ::create($conf);
  5. $ip=$_GET['ip'];
  6. $zmienna = $pq->query_info($ip);
  7. // dane
  8. $name = dupa;
  9. // grafika
  10. $rysunek = imagecreatefrompng ("tlo.png");
  11. $color = ImageColorAllocate($rysunek, 255, 215, 0);
  12. imagestring ($rysunek, 2, 180, 11, "IP: $name", $color); // <- ta linijka
  13. header("Content-type: image/png");
  14. imagepng($rysunek);
  15. ?>

Żeby wyświeltić imię bez obrazka używam echo $zmienna['name'];
Gdy zastapie $name na $zmienna['name']; w 'tej linijce' wywala bład albo nie pokazuje nic.
Pomocy.
Go to the top of the page
+Quote Post
thek
post
Post #2





Grupa: Moderatorzy
Postów: 4 362
Pomógł: 714
Dołączył: 12.02.2009
Skąd: Jak się położę tak leżę :D




Apostrofy!

Do nazwy musisz przekazać string, czyli albo zrobisz
  1. $name = 'dupa';
i potem poprawisz kod na
  1. imagestring ($rysunek, 2, 180, 11, 'IP: '.$name, $color);

Albo użyjesz
  1. imagestring ($rysunek, 2, 180, 11, 'IP: '.$zmienna['name'], $color);
Bo inaczej bawisz się z czymś co nie istnieje (IMG:style_emoticons/default/biggrin.gif)

EDIT: dopisałem drugi bo nie wiem w końcu czy uzywasz jako napisu $name czy $zmienna['name']. Zdecyduj się (IMG:style_emoticons/default/winksmiley.jpg)

Ten post edytował thek 25.08.2009, 14:42:13
Go to the top of the page
+Quote Post
Marcuez
post
Post #3





Grupa: Zarejestrowani
Postów: 98
Pomógł: 1
Dołączył: 7.07.2009
Skąd: Poligon Osielsko

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


  1. <?
  2. // klasa
  3. include("class_PQ.php");
  4. $pq = PQ::create($conf);
  5. $ip=$_GET['ip'];
  6. $zmienna = $pq->query_info($ip);
  7. // grafika
  8. $rysunek = imagecreatefrompng ("tlo.png");
  9. $bialy = ImageColorAllocate($rysunek, 255, 215, 0);
  10. imagestring ($rysunek, 2, 180, 11, 'IP: '.$zmienna['name'], $color); //name
  11. header("Content-type: image/png");
  12. imagepng($rysunek);
  13. ?>

Efekt - KLIK!

Ten post edytował Marcuez 25.08.2009, 14:45:54
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: 15.09.2025 - 04:33