이미지 자동으로 줄여주기...

이미지 자동으로 줄여주기...

QA

이미지 자동으로 줄여주기...

본문

아래 소스는 그누보드4에서 적용하던 건데요.

갤러리 게시판에서 이미지를 자동으로 줄여주던 소스에요.(write_update.skin.php)

당연히 그누보드5에서는 수정을 해서 써야 겠지요?

잘안되네요! 고수님들의 조언 부탁드립니다.


<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path;
$img_width = 727;  //새로 만드는 이미지 사이즈

    $sql2=" select * from $G5_PATH[board_file_table] where  bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no asc";
    $results2 = sql_query($sql2);
    for ($d=0; $row2=sql_fetch_array($results2); $d++)  { 

if ($_FILES[bf_file][name][$d])
{
$file = $data_path .'/'. $row2[bf_file];

$IMG_info = getimagesize ($file);
$thum_W = $IMG_info[0] ;

if ($thum_W > $img_width) {

if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file))
{
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;

$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);

@unlink($data_path.'/'.$row2[bf_file]);
$dst = imagecreatetruecolor($img_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $data_path.'/'.$row2[bf_file], $board[bo_2]);
//imagepng($dst, $data_path.'/'.$row2[bf_file], $board[bo_2]); //주석 해제
chmod($data_path.'/'.$row2[bf_file], 0606);

}  // 네번째 그림형식확인
} //세번째 그림크기확인
}  // 두번째 if
}  //첫번째 for

?>​

 

이 질문에 댓글 쓰기 :

답변 1

$data_path = G5_PATH."/data/file/$bo_table"; 

$thumb_path = $data_path; 
$img_width = 727;  //새로 만드는 이미지 사이즈

    $sql2=" select * from $g5[board_file_table] where  bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no asc";  

답변을 작성하시기 전에 로그인 해주세요.
전체 51
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT