첨부파일이미지 지정된 크기로 저장
첨부파일 이미지가 크기가 큰경우 저장시 지정된 크기로 저장및 뷰화면에 출력시켜줍니다
지정된 이미지보다 작은 경우는 작은 크기로 저장됩니다
아래내용추가 수정하시고요
bbs/write_update.php 에 251라인이요
//$upload[$i][image] = @getimagesize($dest_file);
}
}
를 아래의 소스처렴 변경하시고요 바로아래 bo_table=="Resize" 는 게시판 테이블명이구요 $width = 600; 은 저장및 뷰화면에서 출력되는크기입니다
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $_FILES[bf_file][name][$i]) && file_exists($dest_file) && $bo_table=="Resize")
{
$size = getimagesize($dest_file);
if ($size[2] == 1)
$src = imagecreatefromgif($dest_file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($dest_file);
else if ($size[2] == 3)
$src = imagecreatefrompng($dest_file);
$width = 600;
if($size[0]>$width && $src){
$rate = $width / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
imagejpeg($dst, $dest_file, "95");
chmod($dest_file, 0606);
}
}
}
}
로 변경하시고요
큰이미지 출력시 뷰화면의 리사이징 현상이 없겠지요
출처 - http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=117780