에디터로 등록된 이미지 하나씩 따로 불러오는 방법 문의드립니다.

에디터로 등록된 이미지 하나씩 따로 불러오는 방법 문의드립니다.

QA

에디터로 등록된 이미지 하나씩 따로 불러오는 방법 문의드립니다.

본문

안녕하세요.

목록에 내용을 불러와 보여지게하는 스킨을 수정하려합니다.

아래처럼 수정하다 막혀서 질문드립니다.

 

<?echo stripslashes($list[$i][wr_content]); ?> 여기서 내용을 불러오는데

스마트에디터로 등록한 이미지를

 <div class="swiper-slide"><?echo stripslashes($list[$i][wr_content]); ?></div> 
      <div class="swiper-slide">두번째이미지</div>
      <div class="swiper-slide">세번째이미지</div>
  </div>

위 부분에 하나씩 스크롤하려 합니다.

등록된 이미지를 하나씩 불러와야하는데 '두번째 이미지', '세번째이미지' 부분에 어떻게 불러와야 하는지요?

 

 

<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 5;

if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>


  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

  <!-- Link Swiper's CSS -->
  <link rel="stylesheet" href="../../swiper.css">

  <!-- Demo styles -->
  <style>
    html, body {
      position: relative;
      height: 100%;
    }
    body {
      font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
      font-size: 14px;
      color:#000;
      margin: 0;
      padding: 0;
    }
    .swiper-container {
      width: 100%;
      height: 100%;
    }
    .swiper-slide {
      text-align: center;
      font-size: 18px;
      background: #fff;

      /* Center slide text vertically */
      display: -webkit-box;
      display: -ms-flexbox;
      display: -webkit-flex;
      display: flex;
      -webkit-box-pack: center;
      -ms-flex-pack: center;
      -webkit-justify-content: center;
      justify-content: center;
      -webkit-box-align: center;
      -ms-flex-align: center;
      -webkit-align-items: center;
      align-items: center;
    }
  </style>

 

    <form name="fboardlist" id="fboardlist" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post">
    <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
    <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
    <input type="hidden" name="stx" value="<?php echo $stx ?>">
    <input type="hidden" name="spt" value="<?php echo $spt ?>">
    <input type="hidden" name="sca" value="<?php echo $sca ?>">
    <input type="hidden" name="page" value="<?php echo $page ?>">
    <input type="hidden" name="sw" value="">


<?php for ($i=0; $i<count($list); $i++) { ?>
<? if ($is_checkbox) { ?><input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"  id="chk_wr_id_<?php echo $i ?>"><?}?>      
<? if ($write_href) { ?> <a href="<?=G5_BBS_URL?>/write.php?w=u&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&page=<?=$page?>" class="btn_b01">수정</a><br><?}?>  

  <!-- Swiper -->
  <div class="swiper-container">
    <div class="swiper-wrapper">
   <div class="swiper-slide"><?echo stripslashes($list[0][wr_content]); ?></div> 
      <div class="swiper-slide">두번째이미지</div>
      <div class="swiper-slide">세번째이미지</div>
    </div>
    <!-- Add Arrows -->
    <div class="swiper-button-next"></div>
    <div class="swiper-button-prev"></div>
  </div>

  <!-- Swiper JS -->
  <script src="../../swiper.min.js"></script>

  <!-- Initialize Swiper -->
  <script>
    var swiper = new Swiper('.swiper-container', {
      navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
    });
  </script>

<?php } ?>

 

 <?php if ($list_href || $is_checkbox || $write_href) { ?>
    <div class="bo_fx">
        <?php if ($is_checkbox) { ?>
        <ul class="btn_bo_adm">
            <li><input type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value"></li>
            <li><input type="submit" name="btn_submit" value="선택복사" onclick="document.pressed=this.value"></li>
            <li><input type="submit" name="btn_submit" value="선택이동" onclick="document.pressed=this.value"></li>
   <?php if ($admin_href) { ?><li><a href="<?php echo $admin_href ?>" class="btn_admin">관리자</a></li><?php } ?>
        </ul>
        <?php } ?>

        <?php if ($list_href || $write_href) { ?>
        <ul class="btn_bo_user">
            <?php if ($list_href) { ?><li><a href="<?php echo $list_href ?>" class="btn_b01">목록</a></li><?php } ?>
            <?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
        </ul>
        <?php } ?>
    </div>
    <?php } ?>
    </form>

 

 


<?php if ($is_checkbox) { ?>
<script>
function all_checked(sw) {
    var f = document.fboardlist;

    for (var i=0; i<f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]")
            f.elements[i].checked = sw;
    }
}

function fboardlist_submit(f) {
    var chk_count = 0;

    for (var i=0; i<f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
            chk_count++;
    }

    if (!chk_count) {
        alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
        return false;
    }

    if(document.pressed == "선택복사") {
        select_copy("copy");
        return;
    }

    if(document.pressed == "선택이동") {
        select_copy("move");
        return;
    }

    if(document.pressed == "선택삭제") {
        if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다."))
            return false;

        f.removeAttribute("target");
        f.action = "./board_list_update.php";
    }

    return true;
}

// 선택한 게시물 복사 및 이동
function select_copy(sw) {
    var f = document.fboardlist;

    if (sw == "copy")
        str = "복사";
    else
        str = "이동";

    var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");

    f.sw.value = sw;
    f.target = "move";
    f.action = "./move.php";
    f.submit();
}
</script>
<?php } ?>

이 질문에 댓글 쓰기 :

답변 1

꼭 에디터로 첨부한 이미지를 사용하셔야 하는건가요?

저같은 경우에는 게시물 등록시 파일첨부란을 여러개 해서 

각각 이미지를 첨부한 다음에

리스트에서 이미지 원본을 숫자대로 불러와서 돌리거든요..

 

질답란에 첨부파일 이미지원본 으로 검색해보시면

아래와 같이 원본이미지 불러오는 소스를 찾으실 수 있으신데

 

 

<?            
echo "<a href='{$list[$i][href]}'>"; 
        $image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면 
if (preg_match("/\.(gif|jpg|png)$/i", $image)) { 
echo "<img src='$g5[path]/bbs/data/file/$bo_table/$image' />"; // 이미지크기 
} else echo ""; 
?> 
</a> 

 

이걸 활용해서

$list[$i][file][0][file]

여기 숫자만 늘려주는 방식으로 

 

<img src="<?php echo $g5[path] ?>/bbs/data/file/<?php echo $bo_table?>/<?php echo $list[$i][file][0][file] ?>" />

<img src="<?php echo $g5[path] ?>/bbs/data/file/<?php echo $bo_table?>/<?php echo $list[$i][file][1][file] ?>" />

<img src="<?php echo $g5[path] ?>/bbs/data/file/<?php echo $bo_table?>/<?php echo $list[$i][file][2][file] ?>" />

<img src="<?php echo $g5[path] ?>/bbs/data/file/<?php echo $bo_table?>/<?php echo $list[$i][file][3][file] ?>" />

<img src="<?php echo $g5[path] ?>/bbs/data/file/<?php echo $bo_table?>/<?php echo $list[$i][file][4][file] ?>" />

 

 

이렇게 사용하거든요~~

 

 

 

답변을 작성하시기 전에 로그인 해주세요.
전체 204
QA 내용 검색

회원로그인

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