2026, 새로운 도약을 시작합니다.

첨부된 모든 이미지 용량 조절하기 채택완료

이전 g4에서 잘 사용하던 write.update.skin.php  내용인데 g5에서는 안되네요.

혹 아시는 부분이 있으시면 조언 부탁드립니다.

사이트는 개인nas라 G5_PATH 로 할경우 주소부분이 맞지 않아서 (Dtatvolume/www/board.......) 전혀 동작이 안됩니다.


// 자신만의 코드를 넣어주세요.
$data_path = G5_DATA_URL.'/file/$bo_table';
$thumb_path = $data_path.'/thumb';

$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 = $board[bo_image_width] / $size[0]; // 리사이즈를 원치않으면 여기서부터~~~
$height = (int)($size[1] * $rate);

if ($size[0] > $board[bo_image_width]){

@unlink($data_path.'/'.$row2[bf_file]);
$dst = imagecreatetruecolor($board[bo_image_width], $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_image_width], $height, $size[0], $size[1]);
imagejpeg($dst, $data_path.'/'.$row2[bf_file], 90); //혹 업로드 이미지 깨지면 여긴 주석처리하시고 바로 아래 껄 이용하세요..
// imagepng($dst, $data_path.'/'.$row2[bf_file], $board[bo_2]); //주석 해제
chmod($data_path.'/'.$row2[bf_file], 0606);

$temp = @getimagesize(addslashes($file));

$bf_size = @filesize(addslashes($file)); 
$sql = " update $g5[board_file_table] 
          set
           bf_filesize = '$bf_size', 
           bf_width='$temp[0]', 
           bf_height='$temp[1]', 
           bf_type='$temp[2]' 
            where 
             bo_table = '$bo_table'
             and
              wr_id = '$wr_id'  "; 
sql_query($sql); 

 
 }

답변 3개

채택된 답변
+20 포인트
$data_path = G5_DATA_URL.'/file/$bo_table'; <-- 아래처럼 수정 해보세요
'/file/$bo_table'; 이것은 이렇게 하거나 큰 따옴표로 해야죠 ---> '/file/'.$bo_table;

$data_path = G5_DATA_PATH."/file/$bo_table"; 
또는
$data_path = "../data/file/$bo_table"; 
로그인 후 평가할 수 있습니다

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

많은 도움이 되었습니다. 감사합니다.

로그인 후 평가할 수 있습니다

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

감사합니다.
로그인 후 평가할 수 있습니다

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

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

로그인
🐛 버그신고