최신글 두번째 첨부파일 불러오기
본문
<?php
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
$thumb_width = 615;
$thumb_height = 615;
$sql = "select * from g5_write_01_02 where wr_1 = '1' order by wr_id desc limit 10";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$img_link_html = '';
$wr_href = get_pretty_url('01_02', $row['wr_id']);
$thumb = get_list_thumbnail('01_02', $row['wr_id'], $thumb_width, $thumb_height, false, true);
if($thumb['src']) {
$img = $thumb['src'];
} else {
$img = G5_IMG_URL.'/no_img.png';
$thumb['alt'] = '이미지가 없습니다.';
}
$img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
?>
이렇게 작성되어 있는 쿼리문을 이용해서 두번째 첨부파일만 따로 노출을 시키려고 하는데 감이 안잡혀서요. 도와주시면 감사드리겠습니다.
!-->답변 2
$img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
->
$img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
$file = get_file('01_02', $row['wr_id']);
$img_content2 = '<img src="'.$file[1]['path'].'/'.$file[1]['file'].'" width="150" height="150">';
echo $img_content2;
<?php
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
$thumb_width = 615;
$thumb_height = 615;
$sql = "select * from g5_write_01_02 where wr_1 = '1' order by wr_id desc limit 10";
$result = sql_query($sql);
$attach_second = '';
for ($i=0; $row=sql_fetch_array($result); $i++) {
$img_link_html = '';
$wr_href = get_pretty_url('01_02', $row['wr_id']);
$thumb = get_list_thumbnail('01_02', $row['wr_id'], $thumb_width, $thumb_height, false, true);
if ($i == 1) {
$attach_second = $thumb['src'];
}
if($thumb['src']) {
$img = $thumb['src'];
} else {
$img = G5_IMG_URL.'/no_img.png';
$thumb['alt'] = '이미지가 없습니다.';
}
$img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
}
echo $attach_second;
?>
답변을 작성하시기 전에 로그인 해주세요.