0

PHPで生成された画像アルゴリズムを印刷でデバッグしたい。問題は、印刷したテキストが出力されないことです。デバッグできるように変数を出力するにはどうすればよいですか? ありがとう、フルタノ

 public function drawPicture()
    {
        $im = imagecolorallocate ($this->picture, 255, 0, 255);
        imagettftext($this->picture, $this->fontSize , 0, 100, 100,$im , "cooperm.TTF", $this->name);



        # int ImageCopy ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int $src_x , int $src_y , int $src_w , int $src_h )
        //imagecopy($this->picture, $this->pika, $this->wappen['pika']['dst_x'], $this->wappen['pika']['dst_y'], 0, 0, $this->pika_size[0], $this->pika_size[1]);

        $zufall = rand(1,99999999);

        #header("Content-Type: image/jpeg");
        imagepng($this->picture);

        $this->checkFontSize();

        imagedestroy($this->picture);

        print "WHY_DOESNT_PRINT?";


    }
4

2 に答える 2

1

.png画像をブラウザに送信しているため、ブラウザは画像を表示しようとします。追加のテキストは無効な画像データとして表示されるため、表示されません。

問題の解決策は、header()呼び出しを使用してデバッグメッセージをブラウザに送信するか、Firefox +Firebug+とPHPFirebugアダプタを使用することです。Firebugはヘッダーと連携して情報を送信するため、画像生成機能で安全です。

于 2012-08-10T13:00:16.867 に答える