이미지 가로 세로 긴쪽 기준 썸네일 생성 하려면 채택완료
어떻게 해야 할까요..?
이미지 원본비율 유지하면서
가로 세로 긴쪽 기준으로 썸네일을 생성하려는데 잘 안되네요..
그래서 g4에서 사용하던 썸네일 생성 소스를 만지작 ...
$file = $list[$i][file][0][path].'/'.$list[$i][file][0][file]; if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) { $size = getimagesize($file);
파일명은 나오는데
$size 를 불러오지 못하네요..
답변 4개
위와 같은 건입니다.
소스를 어떤 부분에 넣어야 하는지 좀 부탁드립니다.
제가사용하는
list.skin.php 파일 입니다
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 제목길이 잘 맞추세요. $thu_width = '140'; //썸네일 폭 $thu_height = '120'; //썸네일 높이 $thu_quality = '100'; //썸네일 퀄리티_100 이하
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table"; $thumb_path = $data_path.'/thumb';
@mkdir($thumb_path, 0707); @chmod($thumb_path, 0707);
$mod = $board[bo_gallery_cols]; $td_width = (int)(100 / $mod);
// 선택옵션으로 인해 셀합치기가 가변적으로 변함 $colspan = 5; if ($is_category) $colspan++; if ($is_checkbox) $colspan++; if ($is_good) $colspan++; if ($is_nogood) $colspan++;
// 제목이 두줄로 표시되는 경우 이 코드를 사용해 보세요. //
/* $tmp_bo_table = "cm_gallery_request"; $tmp_write_table = $g4[write_prefix] . $tmp_bo_table; $sql = " select wr_id, wr_subject from $tmp_write_table where wr_is_comment = 0 and wr_comment = 0 order by wr_id desc "; $result = sql_query($sql); for ($i=0; $row=sql_fetch_array($result); $i++) { echo "
"; } */ ?>
if ($is_checkbox) { ?> } ?>
댓글을 작성하려면 로그인이 필요합니다.
$w = (int)$w; //소수점이하 버림 $h = (int)$h;
요거 추가해 주세요..
댓글을 작성하려면 로그인이 필요합니다.
원본 비율 유지하면서 가로 세로 최대 사이즈 지정 썸네일 생성.. (세로로 너무 긴 사진이 있을 경우) $tw_max = 150; //썸네일 가로 최대 사이즈 - 환경설정 무시 $th_max = 110; //썸네일 세로 최대 사이즈 if ($t_w < $tw_max){ if ($t_h > $th_max){ $h = $th_max ; $w = ceil( $t_w * ( $th_max / $t_h ) ); } else { $h = $t_h; $w = $t_w; } }else{ if (( $t_h / $t_w ) > ($th_max / $tw_max)){ $h = $th_max ; $w = ceil( $t_w * ( $th_max / $t_h ) ); }else{ $w = $tw_max ; $h = ceil( $t_h * ( $tw_max / $t_w ) ); } }

댓글을 작성하려면 로그인이 필요합니다.
해결 했습니다.
잘 되는지 좀 봐주세요..
list.skin.php
$t_w = $list[$i][file][0][image_width]; //원본파일 사이즈
$t_h = $list[$i][file][0][image_height];
$t_max = 150; //썸네일 최대 사이즈 - 환경설정 무시
if ($t_w < $t_max){
if ($t_h > $t_max){
$h = $t_max ;
$w = ceil( $t_w * ( $t_max / $t_h ) );
} else {
$h = $t_h;
$w = $t_w;
}
}else{
if (( $t_h / $t_w ) > ($t_max / $t_max)){
$h = $t_max ;
$w = ceil( $t_w * ( $t_max / $t_h ) );
}else{
$w = $t_max ;
$h = ceil( $t_h * ( $t_max / $t_w ) );
}
}
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $w, $h);
// $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
if($thumb['src']) {
$img_content = '';
// $img_content = '
';

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

", $write_pages);
$write_pages = str_replace("이전", "
", $write_pages);
$write_pages = str_replace("다음", "
", $write_pages);
$write_pages = str_replace("맨끝", "
", $write_pages);
$write_pages = preg_replace("/