Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [GD] Błąd w klasie, nie wyświetlanie się obrazka
Forum PHP.pl > Forum > Gotowe rozwiązania
angel2953
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.
Darti
nie wysyłaj nagłówka
  1. <?php
  2. header( &#092;"Content-type: image/png\" ); //<<< ten wiersz wywalic
  3. imagepng( $this->resImage );
  4. ?>
angel2953
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...
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.