Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Obrazki, nanoszenie, aktywny link...
progman
post
Post #1





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 6.07.2006

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


Witam, mam pewien problem, pobieram z bazy danych mapke objektu, rysuje na niej czytniki z pliku.png na określonych pozycjach x,y z bazy. Wszystko z wykorzystaniem GD. Teraz jak zrobić żeby te czytniki.png były aktywnymi lilnkami? Poniżej cały skrypt:

  1. <?php
  2. include ("inc_config.php");
  3.  include ("inc_baza.php");
  4.  include ("inc_get_post_vars.php");
  5.  
  6. if (myGET('table', '0'))
  7. {
  8. $img_table=myGET('table', '0');
  9. }
  10.  
  11. if (myGET('field', '0'))
  12. {
  13. $img_field=myGET('field', '0');
  14. }
  15.  
  16. if (myGET('id', '0'))
  17.  {
  18. $img_id=myGET('id', '0');
  19.  }
  20. else
  21.  {
  22. $img_id=0;
  23.  }
  24.  
  25. $sql = pg_query($conn, 'SELECT mapa FROM wizualizacja WHERE id='.$img_id);
  26.  
  27. $glowice = pg_query($conn, 'SELECT wg.pos_x, wg.pos_y FROM wizualizacja_glowice wg
  28. WHERE wg.id_wizualizacja='.$img_id);
  29.  
  30. $data = pg_unescape_bytea(pg_fetch_result($sql, 0, 'mapa'));
  31.  
  32. header('Content-Type: image/png');
  33.  
  34. $background = imagecreatefromstring($data);
  35. $insert = imagecreatefrompng("czytniki.png");
  36.  
  37. imagecolortransparent($insert,imagecolorexact($insert,255,0,255));
  38.  
  39. $insert_x = imagesx($insert);
  40. $insert_y = imagesy($insert);
  41.  
  42. $count=pg_num_rows($glowice);
  43.  
  44. function linki()
  45. {
  46. print '<MAP NAME="mapa">';
  47. print '<AREA SHAPE="rect" BORDER COORDS="2,31,31,2" HREF="link.php" TITLE="Czytnik" Target="_blank">';
  48. print '</MAP>';
  49. print '<IMG SRC="czytniki.png">';
  50. }
  51.  
  52. for ($x=0;$x<$count;$x++) {
  53. imagecopymerge($background,$insert,pg_fetch_result($glowice, $x, 'pos_x'),pg_fetch_result($glowice, $x, 'pos_y'),0,0,$insert_x,$insert_y,100);
  54. }
  55.  
  56. imagejpeg($background,"",100);
  57. ?>
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 Aktualny czas: 19.08.2025 - 23:28