테스트 사이트 - 개발 중인 베타 버전입니다

업로드시 이미지 리사이징 채택완료

그누가사랑을모르나 10년 전 조회 3,568

여기를 참고해서 http://sir.co.kr/g4_qa/238912">http://sir.co.kr/g4_qa/238912

이미지 업로드 단계에서 리사이징 하기 위해 아래와 같이 추가했습니다.

그런데 사이즈 변화가 없습니다.

어디에 문제가 있는지 모르겠습니다.

위는 그누보드4라  $data_path = $g5[path]."/data/file/$bo_table";

$sql2=" select * from $g5[board_file_table] where  bo_table =

$sql = " update $5[board_file_table]

위 세부분을 $g4 -> $g5로 단순 수정했습니다.

도움말씀 부탁합니다.

 

 

 

******************        /bbs/write_update.php        **********************************

// 업로드된 파일 내용에서 가장 큰 번호를 얻어 거꾸로 확인해 가면서 // 비밀글이라면 세션에 비밀글의 아이디를 저장한다. 자신의 글은 다시 비밀번호를 묻지 않기 위함 $row = sql_fetch(" select max(bf_no) as max_bf_no from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' "); for ($i=(int)$row['max_bf_no']; $i>=0; $i--) {     $row2 = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");

    // 정보가 있다면 빠집니다.     if ($row2['bf_file']) break;

    // 그렇지 않다면 정보를 삭제합니다.     sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); }

 

 

******************     /bbs/write_update.php  573줄 ~     **********************************

 

////////////////////////////////////////// ////////////// 요기부터 내용추가요~!! if ($bo_table != "m_dchaja" && $bo_table != "m_baedal" && $bo_table != "m_product" && $bo_table != "m_dongne" && $bo_table != "m_life" ) { // 제외시킬 게시판 명 $img_limit_width = 660; // 제한할 이미지 폭 $img_quality = 70; // 이미지 품질 $data_path = $g5[path]."/data/file/$bo_table";     $sql2=" select * from $g5[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]; 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_limit_width / $size[0]; $height = (int)($size[1] * $rate); if ($size[0] > $img_limit_width){ @unlink($data_path.'/'.$row2[bf_file]); $dst = imagecreatetruecolor($img_limit_width, $height); imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_limit_width, $height, $size[0], $size[1]); // imagepng($dst, $data_path.'/'.$row2[bf_file], $board[bo_2]); //이부분이 png 압축방식이어서 이미지 커졌나 봅니다. //아래처럼 하니 줄어드는 것을 확실히 느껴집니다....^^    imagejpeg($dst, $data_path.'/'.$row2[bf_file], $img_quality); chmod($data_path.'/'.$row2[bf_file], 0606); //---------->madem님이 알려주신 부분입니다.^^ $bf_size = @filesize(addslashes($file)); $sql = " update $5[board_file_table] set bf_filesize = '$bf_size' where  bo_table = '$bo_table' and wr_id = '$wr_id'  "; sql_query($sql);  //---------->madem님이 알려주신 부분입니다.^^  }  }  }  } }

//////////////////////////////////////////////////////// 요기까지 추가내용 끝

 

 

 

 

// 파일의 개수를 게시물에 업데이트 한다. $row = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' "); sql_query(" update {$write_table} set wr_file = '{$row['cnt']}' where wr_id = '{$wr_id}' ");

// 자동저장된 레코드를 삭제한다. sql_query(" delete from {$g5['autosave_table']} where as_uid = '{$uid}' "); //------------------------------------------------------------------------------

// 비밀글이라면 세션에 비밀글의 아이디를 저장한다. 자신의 글은 다시 비밀번호를 묻지 않기 위함​ 

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
$g5[path]가 아닌 G5_URL오 사용해보세요
로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

그누가사랑을모르나
10년 전
감사합니다. 말씀대로 경로를 수정했는데 아직은 리사이징이 안되네요.
경로부분을 알게 되었으니 더 분석해 보도록 하겠습니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인