원본 비율 유지 썸네일 생성 (리사이즈)
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개
10년 전
썸네일 생성후 파일 위치등은 특별히 지정이 없나요?
10년 전
$t_w 값은 어떻게 가져와야할까요.
10년 전
수정했습니다.
실수로 원본 사이즈를 안가져 왔네요.
실수로 원본 사이즈를 안가져 왔네요.
welcome
8년 전
혹시 업로드할때 바로 리사이즈 적용하는 방법은 없을까요?
8년 전
필요했던건데 테스트 해보겠습니다
감사합니다.
감사합니다.
2년 전
잘 사용했습니다.
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4402 | ||
| 444 | 10년 전 | 9065 | ||
| 443 | 10년 전 | 7053 | ||
| 442 |
|
10년 전 | 9547 | |
| 441 | 10년 전 | 9007 | ||
| 440 |
블랙앤화이트
|
10년 전 | 10104 | |
| 439 | 10년 전 | 8893 | ||
| 438 | 10년 전 | 10201 | ||
| 437 | 10년 전 | 9625 | ||
| 436 | 10년 전 | 10009 | ||
| 435 | 10년 전 | 6342 | ||
| 434 | 10년 전 | 13711 | ||
| 433 | 10년 전 | 8293 | ||
| 432 | 10년 전 | 7006 | ||
| 431 | 10년 전 | 20662 | ||
| 430 | 10년 전 | 11395 | ||
| 429 | 10년 전 | 4582 | ||
| 428 | 10년 전 | 10832 | ||
| 427 | 10년 전 | 9706 | ||
| 426 | 10년 전 | 10269 | ||
| 425 | 10년 전 | 19820 | ||
| 424 | 10년 전 | 10973 | ||
| 423 | 10년 전 | 6593 | ||
| 422 |
untitled
|
10년 전 | 11674 | |
| 421 | 10년 전 | 23217 | ||
| 420 | 10년 전 | 15548 | ||
| 419 |
wkpark
|
10년 전 | 15115 | |
| 418 | 10년 전 | 11394 | ||
| 417 | 10년 전 | 10698 | ||
| 416 |
|
10년 전 | 13349 | |
| 415 | 10년 전 | 8830 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기