갤러리 사진등록시 오류
갤러리에 사진을 등록하면 아래와 같은 오류메세지가 나오고 사진이 등록되지 않습니다.
사이트내에 동일한 갤러리스킨으로 여러 게시판이 있는데, 다른 게시판은 정상적으로 등록되는데
특정 게시판만 오류가 나네요.
고수님들 조언 부탁합니다.
Warning: imagecreatefrompng() [http://paulkid.co.kr/bbs/function.imagecreatefrompng" style="text-decoration: none; color: rgb(70, 108, 138); font-family: Tahoma, 굴림; font-size: 12px; line-height: normal; background-color: rgb(255, 255, 255);">function.imagecreatefrompng]: '../data/file/event/33188526_6tsd9Fio_C7AAB8A5_BEF0B4F6.jpg.old' is not a valid PNG file in/www/paulkid.co.kr/public_html/extend/child_thumb.php on line 29
child_thumb.php
// GD .. 큰이미지 리사이즈 (가로 축소)
function org_resize($bo_table,$org_img,$org_src,$thumbx, $thumby, $wr_id){
global $g4;
$path="$g4[path]/data/file/$bo_table";
$img = "$path/$org_img";
$img_old = "{$img}.old";
$info=@getimagesize($img);
$x=$info[0]; $y=$info[1]; $z=$info[2];
if($z==0 || $z >3 ) return;
// if( $x <=$thumbx ) return;
if($thumby==0){$xx = $thumbx; $yy =ceil($y * $thumbx / $x); }
else if($thumbx==0){$yy = $thumby; $xx =ceil($x * $thumby / $y); }
rename( $img, $img_old);
switch($z) {
case(1) :
if(function_exists('ImageCreateFromGif')) $src_img = ImageCreateFromGif($img_old);
break;
case(2) :
if(function_exists('ImageCreateFromJpeg')) $src_img = ImageCreateFromJpeg($img_old);
break;
case(3) :
if(function_exists('ImageCreateFromPng')) $src_img = ImageCreateFromPng($img_old);
break;
}
if(! $src_img) { unset($src_img); return; }
if(function_exists('ImageCreateTrueColor')) $newimg = ImageCreateTrueColor($xx, $yy);
else $newimg = ImageCreate($xx, $yy);
if(function_exists('ImageCopyResampled'))
ImageCopyResampled($newimg, $src_img , 0,0,0,0, $xx, $yy, $x, $y );
else ImageCopyResized($newimg, $src_img , 0,0,0,0, $xx, $yy, $x, $y );
imagejpeg($newimg, $img, 90);
ImageDestroy($newimg);
imagedestroy($src_img);
unset($src_img);
unset($newimg);
@unlink($img_old);
$imgsize=filesize($img);
sql_query("update $g4[board_file_table] set bf_filesize='$imgsize', bf_width='$xx', bf_height='$yy', bf_type='2'
where bo_table='$bo_table' and wr_id='$wr_id' and bf_source='$org_src' and bf_file ='$org_img'");
return;
}
////////////////////////////////////썸네일 만들기
function tg_thumb($img_src,$width='100', $height='70',$bo_table){
global $g4;
$thumbx2=$thumbx= $width;
$thumby2=$thumby=$height;
$img_path="$g4[path]/data/file/$bo_table";
$img = "$img_path/$img_src";
$thumb_file = "{$img_path}/thumb/{$img_src}";
if( !is_file($img)) return "file not exists";
if(is_file($thumb_file)) return;
$info=@getimagesize($img);
$x=$info[0]; $y=$info[1]; $z=$info[2];
if($z==0 || $z >3 ) return;
if( $x <=$small_width && $y <= $small_height) return 'org';
switch($z) {
case(1) :
if(function_exists('ImageCreateFromGif')) $src_img = ImageCreateFromGif($img);
break;
case(2) :
if(function_exists('ImageCreateFromJpeg')) $src_img = ImageCreateFromJpeg($img);
break;
case(3) :
if(function_exists('ImageCreateFromPng')) $src_img = ImageCreateFromPng($img);
break;
}
if(! $src_img) { unset($src_img); return "thum create fail"; }
$xx = $thumbx; $yy =ceil($y * $thumbx / $x);
if( $yy< $thumby){ $thumbx2 += ceil($thumbx2*0.5);
$xx = $thumbx2; $yy =ceil($y * $thumbx2 / $x);
}
/*
if($x > $y ) { // 세로고정
$yy = $thumby; $xx =ceil($x * $thumby / $y);
if( $xx> $thumbx){ $thumby2 +=ceil($thumby2*0.3);
$yy = $thumby2; $xx =ceil($x * $thumby2 / $y);
}
}
else {
$xx = $thumbx; $yy =ceil($y * $thumbx / $x);
if( $yy> $thumby){ $thumbx2 += ceil($thumbx2*0.3);
$xx = $thumbx2; $yy =ceil($y * $thumbx2 / $x);
}
}
*/
//크롭
$new_xx=$new_yy = 0;
if($xx>$thumbx) $new_xx = ceil( ($xx - $thumbx)/2 ) * -1;
if($yy>$thumby) $new_yy= ceil( ($yy - $thumby)/3 ) * -1;
// if($yy<$thumby) $yy=$thumby;
if(function_exists('ImageCreateTrueColor')) $newimg = ImageCreateTrueColor($thumbx, $thumby);
else $newimg = ImageCreate($thumbx, $thumby);
if(function_exists('ImageCopyResampled'))
ImageCopyResampled($newimg, $src_img , $new_xx,$new_yy,0,0, $xx, $yy, $x, $y );
else ImageCopyResized($newimg, $src_img , $new_xx,$new_yy,0,0, $xx, $yy, $x, $y );
imagejpeg($newimg, $thumb_file, 90);
ImageDestroy($newimg);
imagedestroy($src_img);
unset($src_img);
unset($newimg);
return;
}
?>
답변 1개
답변을 작성하려면 로그인이 필요합니다.
로그인