Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [GD] Błąd w klasie, nie wyświetlanie się obrazka, Pomoc w zlokalizowaniu błędu
angel2953
post 9.03.2005, 10:56:45
Post #1





Grupa: Zarejestrowani
Postów: 199
Pomógł: 5
Dołączył: 8.07.2004
Skąd: gdynia

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


mam następujące pliki:
graph.class.php
  1. <?php
  2.  
  3. error_reporting( E_ALL );
  4.  
  5. class GraphEngine
  6. {
  7. var $intImageWidth;
  8. var $intImageHeight;
  9. var $strImageTitle;
  10. var $resImage;
  11. var $resBlackColor;
  12. var $resTransparentColor;
  13.  
  14. function GraphEngine( $intWidth, $intHeight )
  15. {
  16. $this->intImageWidth = $intWidth;
  17. $this->intImageHeight = $intHeight;
  18. }
  19. function SetTitle( $strTitle )
  20. {
  21. $this->strImageTitle = $strTitle;
  22. }
  23. function DrawGraph()
  24. {
  25. $this->resImage = imagecreate( $this->intImageWidth, $this->intImageHeight );
  26. $this->resTransparentColor = imagecolorallocate( $this->resImage, 1, 1, 1 );
  27. $this->resBlackColor = imagecolorallocate( $this->resImage, 0, 0, 0 );
  28. imagecolortransparent( $this->resImage, $this->resTransparentColor );
  29. imagestring( $this->resImage, 2, 5, 5, $this->strImageTitle, $this->resBlackColor );
  30.  
  31. header( &#092;"Content-type: image/png\" );
  32. imagepng( $this->resImage );
  33. imagedestroy( $this->resImage );
  34. }
  35.  
  36. /**
  37.  * Koniec
  38.  */
  39. }
  40.  
  41. ?>

oraz image.php
  1. <?php
  2.  
  3.  error_reporting( E_ALL );
  4. require_once( &#092;"graph.class.php\" );
  5.  
  6. $g = new GraphEngine( 400, 600 );
  7. $g->SetTitle( &#092;"Test\" );
  8. $g->DrawGraph();
  9.  
  10. ?>

i nie wiem dlaczego ale nie wyświetla się obrazek. Ja nie mogę znaleźć błędu, może wy znajdziecie

z góry thx.


--------------------
Sygnaturkę ukradli
Go to the top of the page
+Quote Post
Darti
post 9.03.2005, 13:22:43
Post #2





Grupa: Zarejestrowani
Postów: 1 076
Pomógł: 62
Dołączył: 6.03.2005
Skąd: Wroc

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


nie wysyłaj nagłówka
  1. <?php
  2. header( &#092;"Content-type: image/png\" ); //<<< ten wiersz wywalic
  3. imagepng( $this->resImage );
  4. ?>


--------------------
The answer is out there, Neo. It's looking for you. And it will find you, if you want it to.
SERVER_SOFTWARE : Apache/2.2.4 (Win32) PHP/5.2.1
MySQL Client API version : 5.0.27
Go to the top of the page
+Quote Post
angel2953
post 9.03.2005, 18:24:06
Post #3





Grupa: Zarejestrowani
Postów: 199
Pomógł: 5
Dołączył: 8.07.2004
Skąd: gdynia

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


Cytat(Darti @ 2005-03-09 14:22:43)
nie wysyłaj nagłówka

to już próbowałem. Żaden błąd nie wyskakuje tylko:
Kod
‰PNG

  
IHDR    X   v""Ë   PLTE   ëç$ż   tRNS @ćŘf   dIDATxœíͱ@PEÁ'"úCZ’+D)JP’R”˘†›Án~ćTńKý]g˜t•'m{ŇdÚăËĽÄÉ8äÉ~ĄI[0                            &gt;÷ œĽ~;œ‡    IEND®B`‚

tylko takie krzaczki...


--------------------
Sygnaturkę ukradli
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: 29.06.2025 - 04:20