원본 비율 유지 썸네일 생성 (리사이즈)
list.skin.php
해당 게시판 환경설정은 무시됨
$tw_max = 150; //썸네일 가로 최대 사이즈
$th_max = 150; //썸네일 세로 최대 사이즈
$data_path = G5_URL."/data/file/".$bo_table;
$file_list = urlencode($list[$i][file][0][file]);
if (preg_match("/\.(gif|jpg|png)$/i", $file_list)) {
//$file_ori = $data_path ."/".$file_list; //원본 이미지
$t_w = $list[$i][file][0][image_width]; //원본파일 사이즈
$t_h = $list[$i][file][0][image_height];
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 ) );
}
}
$w = (int)$w; //소수점이하 버림
$h = (int)$h;
$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 src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$w.'" height="'.$h.'">';
} else {
$img_content = '<span style="width:'.$w.'px;height:'.$h.'px">no image</span>';
}
echo $img_content;
}
해당 게시판 환경설정은 무시됨
$tw_max = 150; //썸네일 가로 최대 사이즈
$th_max = 150; //썸네일 세로 최대 사이즈
$data_path = G5_URL."/data/file/".$bo_table;
$file_list = urlencode($list[$i][file][0][file]);
if (preg_match("/\.(gif|jpg|png)$/i", $file_list)) {
//$file_ori = $data_path ."/".$file_list; //원본 이미지
$t_w = $list[$i][file][0][image_width]; //원본파일 사이즈
$t_h = $list[$i][file][0][image_height];
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 ) );
}
}
$w = (int)$w; //소수점이하 버림
$h = (int)$h;
$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 src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$w.'" height="'.$h.'">';
} else {
$img_content = '<span style="width:'.$w.'px;height:'.$h.'px">no image</span>';
}
echo $img_content;
}
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 6개
실수로 원본 사이즈를 안가져 왔네요.
감사합니다.