썸네일 최신글 한게시글에서 2개이상 이미지 출력하기 질문드립니다!! > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

썸네일 최신글 한게시글에서 2개이상 이미지 출력하기 질문드립니다!! 정보

썸네일 최신글 한게시글에서 2개이상 이미지 출력하기 질문드립니다!!

본문

먼저 올렸는데 아직 방법을 찾지 못해 다시 글을 씁니다. T.T

스킨자료실에있는 휴넷님이 올리신 최신글 스킨을 사용하고 있습니다.

아래는 소스입니다.
----------------------------------------------------------------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
?>
<script>
/*
rolling page by hong..
*/
var leftCt = 0;
$(function(){
$("#album").attr("top", "0");
$("#imgList").attr("timer", setInterval("imgRight()", 3000)); // 멈춰있는 시간
$("#_sub0").css("color", "ff7200");
$("#_sub4").css("color", "6A6A6A");
});
function imgStart(tp){
clearInterval($("#imgList").attr("timer"));
if(tp == "R"){ // 오른쪽 이동

$("#imgList").attr("timer", setInterval("imgRight()", 3000)); // 멈춰있는 시간
imgRight();
}else{ // 왼쪽이동
if(leftCt == 0){
var leng = $("#imgList div").size();
$("#imgList").css("left",parseInt($("#imgList div").eq(0).width()*-1));
$("#imgList>div").eq(parseInt(leng-1)).clone().prependTo($("#imgList"));
$("#imgList>div").eq(leng).remove();
leftCt = 1;
}

$("#imgList").attr("timer", setInterval("imgLeft()", 3000));
imgLeft();
}
}
function imgRight(){
$("#imgList").animate({
left : parseInt($("#imgList div").eq(0).width() * -1)
},300,function(){
$("#imgList").css("left", "0px");
$("#imgList>div").eq(0).clone().appendTo($("#imgList"));
$("#imgList>div").eq(0).remove();
});

var cnt = parseInt($("#hidd_cnt").val());
var precnt = cnt - 1;

if (cnt==0)
{
$("#_sub0").css("color", "ff7200");
$("#_sub4").css("color", "6A6A6A");
}else{
$("#_sub"+cnt).css("color", "ff7200");
$("#_sub"+precnt).css("color", "6A6A6A");
}

cnt = cnt + 1;
// precnt = cnt - 1;

if (cnt > 4)
{
cnt = 0;
}
$("#hidd_cnt").val(cnt);

}
function imgLeft(){
var leng = $("#imgList div").size();
$("#imgList").animate({
left : 0
},300,function(){
$("#imgList").css("left", "0px");
$("#imgList").css("left",parseInt($("#imgList div").eq(0).width()*-1));
$("#imgList>div").eq(parseInt(leng-1)).clone().prependTo($("#imgList"));
$("#imgList>div").eq(leng).remove();
});
}
</script>
<style>
/*
이미지 사이즈 맞춰서 수정해주세요... (#viewArea)
*/
#back {position:relative; width:170px; height:110px;  background-color:#fafafa; border:#e2e6e9 0px solid;}
#viewArea {position:relative; width:150px; height:110px; overflow:hidden; left:0px; top:0px;}
#imgList {position:absolute; width:800px; left:0px; top:0px;}
#imgList div {float:left; padding:0px; }
#btnLeft {position:absolute; left:10px; float:left; z-index:10; top:43px; cursor:hand;}
#btnRight {position:absolute; right:10px; float:right; z-index:10; top:43px; cursor:hand;}
</style>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
    <td width=14><img src='<?=$latest_skin_path?>/img/latest_t01.gif'></td>
    <td width='100%' background='<?=$latest_skin_path?>/img/bg_latest.gif'>&nbsp;&nbsp;<strong><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><?=$board[bo_subject]?></a></strong></td>
    <td width=37 background='<?=$latest_skin_path?>/img/bg_latest.gif'><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src='<?=$latest_skin_path?>/img/more.gif' border=0></a></td>
    <td width=14><img src='<?=$latest_skin_path?>/img/latest_t02.gif'></td>
</tr>
</table>
<input type="hidden" id="hidd_cnt" value="1">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="160" align="center" valign="top">
<div id="back">
<div id="viewArea">
<div id="imgList">
    <? for ($i=0; $i<count($list); $i++) {

$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image;  //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];
?>
<div><a href="<?=$list[$i]['href']?>"><img src='<?=$img?>' width="150" height="110" border="0"></a></div>       
    <? } ?>
</div>
</div>
<!--<div id="btnLeft">
<span onClick="imgStart('L')"><img src='<?=$latest_skin_path?>/img/btn_left.gif' border="0" align=absmiddle></span>
</div>
<div id="btnRight">
<span onClick="imgStart('R')"><img src='<?=$latest_skin_path?>/img/btn_right.gif' border="0" align=absmiddle></span>
</div>-->
</div>
</td>
<td>
<table width=470 cellpadding=0 cellspacing=0>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
    <td colspan=4 align=center>
        <table width=100%>
        <tr>
            <td height=17><img src='<?=$latest_skin_path?>/img/latest_icon.gif' align=absmiddle>&nbsp;&nbsp;
            <?
            echo $list[$i]['icon_reply'] . " ";
            echo "<a href='{$list[$i]['href']}'>";
            if ($list[$i]['is_notice'])
                echo "<font style='font-family:나눔고딕; font-size:9pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>";
            else
                echo "<font style='font-family:나눔고딕; font-size:9pt; color:#6A6A6A; font:bold;' id='_sub".$i."'>{$list[$i]['subject']}</font>";
            echo "</a>";

            if ($list[$i]['comment_cnt'])
                echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:나눔고딕; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";

            // if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
            // if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }

            echo " " . $list[$i]['icon_new'];
            echo " " . $list[$i]['icon_file'];
            echo " " . $list[$i]['icon_link'];
            echo " " . $list[$i]['icon_hot'];
            echo " " . $list[$i]['icon_secret'];
            ?></td>
<td align=right>
<font style='font-family:tahoma; font-size:12px; color:#2266c7;'><?echo $list[$i]['datetime'];?></font>&nbsp;
</td></tr>
        </table></td>
</tr>
<? } ?>

<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>

</table>
</td></tr></table>

---------------------소스 끝--------------------------------------------

$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image;  //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];
?>

여기서 $image = $list[$i][file][0][file];  0부분을 1로 바꾸면

2번째 올린 이미지 파일 출력이 잘 됩니다.

그래서 저 테이블 바로아래 똑같은 테이블을 만들어서

새로 붙여넣기한 곳의 $image = $list[$i][file][0][file];  0부분을 1로 바꾸면

첫번째 이미지만 출력이 되는데

혹시 방법을 알고 계시는분이 있으신지 해서 다시금 글남겨 봅니다

첫번째 이미지가 지금 출력되는 형식이고

두번째 이미지가 한 게시글에 포함되어있는 2개이상의 이미지 파일을 출력했을때

나타내고자 하는 형식입니다.

그럼 수고들하세요~

댓글 전체

전체 40 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT