최신글 썸네일 이미지 사이즈 auto로 생성 하는 방법 문의
본문
최신글을 swiper-slide를 이용해서 만들었는데 높이를 이미지 사이즈에 따라 변경되도록 만들었습니다.
그런데 썸네일을 불러올때 모두 고정 값으로 불러와버리니 이미지가 모두 똑같은 사이즈로 나열이 됩니다.
가로 이미지만 고정하고 세로 이미지는 auto로 설정해서 세로 길이를 다르게 불러 올 수 있는 방법이 있을까요?
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
$imgwidth = "500"; //표시할 이미지의 가로사이즈
$imgheight = "330"; //표시할 이미지의 세로사이즈
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 1);
?>
<?php for ($i=0; $i<count($list); $i++) { ?>
<div class='swiper-slide slider0<?php echo ($i+1); ?>'>
<div class="img_box">
<a href="<?=$list[$i]['href']?>">
<?php
$thumb = get_list_thumbnail($list[$i]['bo_table'], $list[$i]['wr_id'], $imgwidth, $imgheight, false, true);
$img_content = 'NO IMAGE';
if($thumb['src']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$list[$i]['subject'].'" >';
}
echo $img_content;
?>
</a>
</div>
</div>
<?php } ?>
<?php if (count($list) == 0) { //게시물이 없을 때 ?>
<div style="width: 100%; text-align:center;">게시물이 없습니다.</div>
<?php } ?>
답변을 작성하시기 전에 로그인 해주세요.