php 막대그래프 프로그래밍(png 파일 문제?)

kjw7945의 이미지

php 그래프 프로그래밍을 해보았습니다. 여기서는 그래프를 png파일로
그리는 건데요. 그러나 모질라, 인터넷 익스플로러 브라우저에서 모두 확인해
본 결과 그림이 나오지 않았습니다. 대신 공간은 잡는거 까지는 나왔습니다.
화면에서 블럭지정을 하면 이미지 공간은 잡히는 것은 보였습니다. 그러나
그림이 안나와서 지금 문제 입니다......음...현제 생각은 libpng라이브러리가
잘못되었는지 그 생각이 나는데요. 그러나 분명 소스 설치 할때 아무런 문제도
없었고 php 소스설치때도 문제 없이 잘 되었습니다... 어떤 문제인지 어떻게
해야 할지 잘 몰라서 답답한 상태입니다...

소스가 너무 길어서....올리지 말까 생각하다 너무 길어서 혹시나 보아야 할지도
몰라서 마지막에 올립니다...

항상 답변해 주시는 분들께 감사드립니다.

<?
header("Content-type: image/png");//이미지 공간형성
$width = 480;
$height = 250;
$image = imagecreate($width, $height); // 색깔 설정

$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);
$black = imagecolorallocate($image, 0x00, 0x00, 0x00);
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);

imagepng($image);
imagedestroy($image);

$data = array( "Jan" => 55, "Feb" => 54, "Mar" => 53, "Apr" => 33, "May" => 13, "Jun" => 15, "Jul" => 23, "Aug" => 28, "Sep" => 32, "Oct" => 45, "Nov" => 73, "Dec" => 71 );

$maxval = max($data);
$nval = sizeof($data);
$vmargin = 20;
$hmargin = 38;
$base = floor(($width - $hmargin) / $nval);

$ysize = $height - 2 * $vmargin;
$xsize = $nval * $base;
imagerectangle($image, $hmargin, $vmargin, $hmargin + $xsize, $vmargin + $ysize, $black);

$titlefont = 3;
$title = "Amount of sell";
$txtsz = imagefontwidth($titlefont) * strlen($title);
$xpos = (int)($hmargin + ($xsize-$txtsz)/2);
$xpos = max(1, $xpos);
$ypos = 3;
imagestring($image, $titlefont, $xpos, $ypos, $title, $black); 

$labelfont = 2;
$ngrid = 4;
$dydat = $maxval / $ngrid;
$dypix = $ysize / ($ngrid + 1); 
for ($i = 0; $i <= ($ngrid + 1); $i++) {
$ydat = (int)($i * $dydat);
$ypos = $vmargin + $ysize - (int)($i*$dypix);
$txtsz = imagefontwidth($labelfont) * strlen($ydat);
$txtht = imagefontheight($labelfont);
$xpos = (int)(($hmargin - $txtsz) / 2);
$xpos = max(1, $xpos);
imagestring($image, $labelfont, $xpos, $ypos - (int)($txtht/2), $ydat, $black);

if (!($i == 0) &&!($i >$ngrid))
imageline($image, $hmargin - 3, $ypos, $hmargin + $xsize,&nbsp;$ypos, $gray);  }

$padding = 3; 
$yscale = $ysize / (($ngrid+1) * $dydat);
for ($i = 0; list($xval, $yval) = each($data); $i++) {

$ymax = $vmargin + $ysize;
$ymin = $ymax - (int)($yval*$yscale);
$xmax = $hmargin + ($i+1)*$base - $padding;
$xmin = $hmargin + $i*$base + $padding
imagefilledrectangle($image, $xmin, $ymin, $xmax, x,&nbsp;$navy);

$txtsz = imagefontwidth($labelfont) * strlen($xval);
$xpos = $xmin + (int)(($base - $txtsz) / 2);
$xpos = max($xmin, $xpos);
$ypos = $ymax + 3;
imagestring($image, $labelfont, $xpos, $ypos, $xval,$black);

?}
kall의 이미지

12-13라인의

imagepng($image);
imagedestroy($image);

코드를 마지막 부분으로 옮기세요.

----
자신을 이길 수 있는자는
무슨짓이든 할수있다..
즉..무서운 넘이란 말이지 ^-_-^
나? 아직 멀었지 ㅠㅠ

익명 사용자의 이미지

답변해 주셔서 감사합니다.