채택완료

첨부파일 이미지를 목록에서 롤링되게하는법이 있나요?

글쓰기에서 첨부파일에 업로드한 이미지가
글목록에 이미지가 나오게 되는데 첨부파일1에 첨부된 이미지가 나옵니다
이 목록에 나온이미지를
첨부파일2,첨부파일3...이미지를 롤링되게 하는 팁이 있을까요?

 
|

답변 2개 / 댓글 1개

채택된 답변
+20 포인트
list.skin.php 의 ul 부분 교체
Copy
<ul id="gall_ul" class="gall_row">
        <?php for ($i=0; $i<count($list); $i++) {

            $classes = array();
            
            $classes[] = 'gall_li';
            $classes[] = 'col-gn-'.$bo_gallery_cols;

            if( $i && ($i % $bo_gallery_cols == 0) ){
                $classes[] = 'box_clear';
            }

            if( $wr_id && $wr_id == $list[$i]['wr_id'] ){
                $classes[] = 'gall_now';
            }

            $line_height_style = ($board['bo_gallery_height'] > 0) ? 'line-height:'.$board['bo_gallery_height'].'px' : '';
         ?>
        <li class="<?php echo implode(' ', $classes); ?>">
            <div class="gall_box">
                <div class="gall_chk chk_box">
                    <?php if ($is_checkbox) { ?>
                    <input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>" class="selec_chk">
                    <label for="chk_wr_id_<?php echo $i ?>">
                        <span></span>
                        <b class="sound_only"><?php echo $list[$i]['subject'] ?></b>
                    </label>

                    <?php } ?>
                    <span class="sound_only">
                        <?php
                        if ($wr_id == $list[$i]['wr_id'])
                            echo "<span class=\"bo_current\">열람중</span>";
                        else
                            echo $list[$i]['num'];
                         ?>
                    </span>
                </div>
                <div class="gall_con">
                    <div class="gall_img" style="<?php if ($board['bo_gallery_height'] > 0) echo 'height:'.$board['bo_gallery_height'].'px;max-height:'.$board['bo_gallery_height'].'px'; ?>">
                        <a href="<?php echo $list[$i]['href'] ?>">
                        <?php
                        if ($list[$i]['is_notice']) { // 공지사항  ?>
                            <span class="is_notice" style="<?php echo $line_height_style; ?>">공지</span>
                        <?php
                        } else {
                            $file_count = isset($list[$i]['file']['count']) ? $list[$i]['file']['count'] : 0;

                            // 첨부파일이 있으면 롤링
                            if($file_count > 0) {

                                echo '<div class="gall_slide" data-slide>';

                                for($f=0; $f<$file_count; $f++) {

                                    if(!empty($list[$i]['file'][$f]['file'])) {
                                        echo '<img src="'.G5_DATA_URL.'/file/'.$board['bo_table'].'/'.$list[$i]['file'][$f]['file'].'" alt="'.$f.'" class="slide_img" loading="lazy">';
                                    }
                                }

                                echo '</div>';
                            } else {
                                $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);

                                if($thumb['src']) {
                                    $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
                                } else {
                                    $img_content = '<span class="no_image" style="'.$line_height_style.'">no image</span>';
                                }

                                echo run_replace('thumb_image_tag', $img_content, $thumb);
                            }
                        }
                        ?>
                        </a>
                    </div>
                    <div class="gall_text_href">
                        <?php if ($is_category && $list[$i]['ca_name']) { ?>
                        <a href="<?php echo $list[$i]['ca_name_href'] ?>" class="bo_cate_link"><?php echo $list[$i]['ca_name'] ?></a>
                        <?php } ?>
                        <a href="<?php echo $list[$i]['href'] ?>" class="bo_tit">
                            <?php echo $list[$i]['subject'] ?>
                            <?php // echo $list[$i]['icon_reply']; ?>
                            <!-- 갤러리 댓글기능 사용시 주석을 제거하세요. -->

                            <?php echo $list[$i]['subject'] ?>                      
                            <?php
                            // if ($list[$i]['file']['count']) { echo '<'.$list[$i]['file']['count'].'>'; }
                            if ($list[$i]['icon_new']) echo "<span class=\"new_icon\">N<span class=\"sound_only\">새글</span></span>";
                            if (isset($list[$i]['icon_hot'])) echo rtrim($list[$i]['icon_hot']);
                            //if (isset($list[$i]['icon_file'])) echo rtrim($list[$i]['icon_file']);
                            //if (isset($list[$i]['icon_link'])) echo rtrim($list[$i]['icon_link']);
                            if (isset($list[$i]['icon_secret'])) echo rtrim($list[$i]['icon_secret']);
                            ?>
                            <?php if ($list[$i]['comment_cnt']) { ?><span class="sound_only">댓글</span><span class="cnt_cmt"><?php echo $list[$i]['wr_comment']; ?></span><span class="sound_only">개</span><?php } ?>
                         </a>
                         <span class="bo_cnt"><?php echo utf8_strcut(strip_tags($list[$i]['wr_content']), 68, '..'); ?></span>
                    </div>

                    <div class="gall_info">
                        <span class="sound_only">작성자 </span><?php echo $list[$i]['name'] ?>
                        <span class="gall_date"><span class="sound_only">작성일 </span><i class="fa fa-clock-o" aria-hidden="true"></i> <?php echo $list[$i]['datetime2'] ?></span>
                        <span class="gall_view"><span class="sound_only">조회 </span><i class="fa fa-eye" aria-hidden="true"></i> <?php echo $list[$i]['wr_hit'] ?></span>
                    </div>
                    <div class="gall_option">
                      <?php if ($is_good) { ?><span class="sound_only">추천</span><strong><i class="fa fa-thumbs-o-up" aria-hidden="true"></i> <?php echo $list[$i]['wr_good'] ?></strong><?php } ?>
                        <?php if ($is_nogood) { ?><span class="sound_only">비추천</span><strong><i class="fa fa-thumbs-o-down" aria-hidden="true"></i> <?php echo $list[$i]['wr_nogood'] ?></strong><?php } ?>           
                    </div>
                </div>
            </div>
        </li>
        <?php } ?>
        <?php if (count($list) == 0) { echo "<li class=\"empty_list\">게시물이 없습니다.</li>"; } ?>
    </ul>

    <style>
    .gall_slide {
        position: relative;
        width: 100%;
        height: 100%;
        min-height: 100%;
    }

    .gall_slide img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: none;
    }

    .gall_slide img:first-child {
        display: block;
    }
    </style>
    <script>
    document.addEventListener("DOMContentLoaded", function(){

        document.querySelectorAll("[data-slide]").forEach(function(slideBox){

            const imgs = slideBox.querySelectorAll("img");
            if(imgs.length < 2) return;

            let index = 0;

            setInterval(function(){

                imgs[index].style.display = "none";
                index = (index + 1) % imgs.length;
                imgs[index].style.display = "block";

            }, 2500);

        });

    });
    </script>

답변에 대한 댓글 1개

tfed1214@naver.com 연락주세요. 확인해보고 해드리겠습니다.

잘되시면 채택해주세요~

답변을 작성하려면 로그인이 필요합니다.