highslide 관련 질문 > 그누4 질문답변

그누4 질문답변

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

highslide 관련 질문 정보

highslide 관련 질문

본문

갤러리 리스트에 사용하는 소스입니다.
이곳 스킨을 이용하였구요
 
for ($i=0; $i<count($list); $i++) {
    if ($i && $i%$mod==0)
        echo "</tr><tr>";
    $img = "<img src='$board_skin_path/img/noimage.gif' border=0 title='이미지 없음'>";
    $thumb = $thumb_path.'/'.$list[$i][wr_id];
    $thumb1 = $thumb_path.'/'.$list[$i][wr_id];
    $file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
    $exif = @exif_read_data($file);
    if (!file_exists($thumb)) {
        if (preg_match("/\.(jpg|gif|png)$/i", $file) && file_exists($file)) {
            $thumb_file = "{$thumb_path}/{$list[$i][wr_id]}";
            $size = @getimagesize($file);
            if ($size[2] == 1)
                $src = imagecreatefromgif($file);
            else if ($size[2] == 2)
                $src = imagecreatefromjpeg($file);
            else if ($size[2] == 3)
                $src = imagecreatefrompng($file);
            else
                continue;
            if ($size[0] > $size[1]) {
                $rate = $board[bo_1] / $size[0];
                $height = (int)($size[1] * $rate);
                $img_width = $board[bo_1];
                $img_height = $height;
            } else {
                $rate = $board[bo_1] / $size[1];
                $width = (int)($size[0] * $rate);
                $img_width = $width;
                $img_height = $board[bo_1];
            }
            createThumb2($img_width, $img_height, $file, $thumb, $list[$i][mb_id]);
           
            $thumb_file = "{$thumb_path}/{$list[$i][wr_id]}_{$img2_width}x{$img2_height}";
            createThumb($img2_width, $img2_height, $file, $thumb_file);
            $sql = " update $write_table set wr_10 = '$exif[Model]' where wr_id = '{$list[$i][wr_id]}' ";
            sql_query($sql);
        }
    }
    $thumb_file = "{$thumb_path}/{$list[$i][wr_id]}_{$img2_width}x{$img2_height}";
    if (file_exists($thumb_file)) {
        $size = getimagesize($thumb_file);
        $img = "<div style='width:{$size[0]}px; border:1px solid #cccccc;background:#EEEEEE;padding:4px;'><a href=\"{$list[$i][comment_href]}\"><img src='$thumb_file' border=0></a></div>";
    }
    $style = "";
    //if ($list[$i][icon_new]) $style = " style='font-weight:bold;' ";
    //$subject1 = "<span $style>".cut_str($list[$i][subject],20)."</span>";
    $subject = "<span $style>{$list[$i][subject]}</span>";
    $comment_cnt = "";
    if ($list[$i][comment_cnt])
        $comment_cnt = " <a href=\"{$list[$i][comment_href]}\"><span class='commentFont'>{$list[$i][comment_cnt]}</span></a>";
    $list[$i][name] = preg_replace("/<img /", "<img style='display:none;' ", $list[$i][name]);
    $list[$i][name] = preg_replace("/> <span/", "><span", $list[$i][name]);
    $list[$i][name] = preg_replace("/class='member'/", "", $list[$i][name]);
    //echo "<td width='{$td_width}%' valign=bottom style='word-break:break-all;padding-left:10px;padding-right:10px;'>";
    echo "<td width='{$td_width}%' valign=bottom style='word-break:break-all;padding:0 10 0 10px;'>";
    echo "<table align=center>";
    echo "<tr><td height=5></td></tr>";
    //echo "<tr><td align=center><a href='{$list[$i][href]}'>$img</a></td></tr>";
    echo "<tr><td align=center><div id='highslide-container'></div><a href='$thumb1' class='highslide' onclick='return hs.expand(this)'><img src='$thumb_file' id='thumb1'></a>
<div id='caption-for-thumb1' class='highslide-caption'>
<a href='#' onclick='return hs.previous(this)' title='Previous (left arrow key)'>← prev</a> ||
<a href='#' onclick='return hs.next(this)' title='Next (right arrow key)'>Next →</a>
<span class='v1'><a href='{$list[$i][href]}'>$subject</a>{$comment_cnt}</nobr></span></a>
    <a href='#' class='control' onclick='return hs.close(this)' title='Close'>닫기</a>
    <a href='#' class='highslide-move' title='Click and drag to move' style='margin-left: 10px'>이동</a>
</div>
</td></tr>";
    echo "<tr><td align=center class=lh>";
    //echo "<nobr style='display:block;overflow:hidden;width:145px;'><span class=small><a href='{$list[$i][ca_name_href]}'>[{$list[$i][ca_name]}]</a></span> ";
    echo "<a href='{$list[$i][href]}'>$subject</a>{$comment_cnt}</nobr>";
    //echo "<span class=small><font color=gray>";
    //echo "<span class='lsm'><a href='$g4[bbs_path]/board.php?bo_table=$bo_table&sca=$sca&sfl=wr_10&stx=$exif[Model]&sop=and'>";
    //echo "$exif[Model]</a></span>";
 
==================================================================
 
상기와 같이 하니 아무 문제가 없는데요 이미지를 클릭하면 새창이 뜹니다.
그런데 새창안의 제목이 계속 똑같이 만 나오네요^^;
각가의 이미지를 클릭 했을대 해당 이미지의 제목글이 나오게 할려면 어떻게 해야 하나요?

댓글 전체

아래 부분에서 id값이 중복되는 부분에 고유값이 오도록 수정해보세요.

<img src='$thumb_file' id='thumb1'></a>
<div id='caption-for-thumb1' class='highslide-caption'>
-->>
<img src='$thumb_file' id='thumb_<?=$bo_table.$list[$i]['wr_id']?>'></a>
<div id='caption_<?=$bo_table.$list[$i]['wr_id']?>' class='highslide-caption'>

---------------------------------------------------------
참고로 highslide 3.1.8 이면 아래 코드로 대체후 테스트도 가능할겁니다.

<a id="thumb_<?=$bo_table.$list[$i]['wr_id']?>" href="<?=$thumb1?>" class="highslide" onclick="return hs.expand(this, { captionId: 'caption_<?=$bo_table.$list[$i]['wr_id']?>' } )">
<img src="<?=$thumb_file?>" alt="썸네일" title="크게보기" /></a>

<div class='highslide-caption' id='caption_<?=$bo_table.$list[$i]['wr_id']?>'>
  <?=$subject?>
  (<? echo "Date:".$list[$i]['datetime']; echo ($list[$i]['datetime2'] != $list[$i]['last2'])?" Comment:".$list[$i]['last2']."":'';?> Hit:<?=$list[$i]['wr_hit']?>)
</div>
<?
}//for
?>

추가로 콘트롤바는 반복할필요없이 for문 밖으로 빼주시는게 좋습니다.
<div id="controlbar" class="highslide-overlay controlbar">
<a href="#" onclick="return hs.previous(this)" title="이전(왼쪽화살표키)"></a>
<a href="#" onclick="return hs.next(this)" title="다음(오른쪽화살표키)"></a>
    <a href="#" class="highslide-move" title="이동"
    style="margin-left: 10px"></a>
    <a href="#" onclick="return hs.close(this)" title="닫기"></a>

</div>
전체 30 |RSS
그누4 질문답변 내용 검색

회원로그인

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