[PHP i GD] Błąd w klasie

0

mam następujące pliki:
graph.class.php

<?php

error_reporting( E_ALL );

class GraphEngine
{
    var $intImageWidth;
    var $intImageHeight;
    var $strImageTitle;
    var $resImage;
    var $resBlackColor;
    var $resTransparentColor;

    function GraphEngine( $intWidth, $intHeight )
    {
        $this->intImageWidth = $intWidth;
        $this->intImageHeight = $intHeight;
    }
    function SetTitle( $strTitle )
    {
        $this->strImageTitle = $strTitle;
    }
    function DrawGraph()
    {
        $this->resImage = imagecreate( $this->intImageWidth, $this->intImageHeight );
        $this->resTransparentColor = imagecolorallocate( $this->resImage, 1, 1, 1 );
        $this->resBlackColor = imagecolorallocate( $this->resImage, 0, 0, 0 );
        imagecolortransparent( $this->resImage, $this->resTransparentColor );
        imagestring( $this->resImage, 2, 5, 5, $this->strImageTitle, $this->resBlackColor );

        header( "Content-type: image/png" );
        imagepng( $this->resImage );
        imagedestroy( $this->resImage );
    }
    
/**
 * Koniec
 */
}
?>

oraz image.php

<?php
    error_reporting( E_ALL );
    require_once( "graph.class.php" );
    
    $g = new GraphEngine( 400, 600 );
    $g->SetTitle( "Test" );
    $g->DrawGraph();
?>

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

z góry thx...

0

Obrazek sie wyswietla .....
user image

moze konfig...

0

No to super... Ja dostaję tylko krzaczki albo info, że obrazek zawiera błędy... heeh...

0

To pokaz te bledy moze sie da cos zrobic bo tak raczej nic ...

0

a gdzie sprawdzasz ?

zobacz dla sprawdzenia czy zadziała:

imagepng( $this->resImage,'plik.png');
header('Location: plik.png');

zamiast

header( "Content-type: image/png" );
imagepng( $this->resImage );

ale to tylko dla testu oczywiście

0
reichel napisał(a)

To pokaz te bledy moze sie da cos zrobic bo tak raczej nic ...

Dostaje taki komunikat:

Obrazek <i>"http://localhost/image.php"</i> nie może zostać wyświetlony poniważ zawiera błędy.
Adamo napisał(a)

a gdzie sprawdzasz ?

zobacz dla sprawdzenia czy zadziała:

imagepng( $this->resImage,'plik.png');
header('Location: plik.png');

zamiast

header( "Content-type: image/png" );
imagepng( $this->resImage );

ale to tylko dla testu oczywiście

Adamo sprawdzam na localhoście i na serwerze w sieci i jest to samo...
wtf!! To działa... To wtakim razie czemu mój sposób nie działa???

0

w takim razie zrąbany jest konfig serwera lub sam serwer na którym to sprawdzasz :) (to nie było śmieszne :P)

a mi działa normalnie i na localu i na serwerku zew

1 użytkowników online, w tym zalogowanych: 0, gości: 1