그누보드 최신글 첨부파일 슬라이드관련 질문드립니다.

그누보드 최신글 첨부파일 슬라이드관련 질문드립니다.

QA

그누보드 최신글 첨부파일 슬라이드관련 질문드립니다.

본문

안녕하세요?

최신글 추출에서

이미지 에디터말고 첨부파일을 첨부한대로 이미지가 전부 다 나와서 슬라이드로 만들고 싶은데요.


<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 10);

$sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' ";
$result = sql_query($sql);
$row=sql_fetch_array($result);
if ($row['bo_gallery_width'] == 0){
    $thumb_width = $row['bo_gallery_height'];
} else {
    $thumb_width = $row['bo_gallery_width'];
}
if ($row['bo_gallery_height'] == 0){
    $thumb_height = $row['bo_gallery_width'];
} else {
    $thumb_height = $row['bo_gallery_height'];
}
?>

    
   
    <?php
    for ($i=0; $i<count($list); $i++) {
    $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
    $youtubeID = $list[$i]['wr_link1']; 
    $youtubeID = explode('/',$youtubeID); 
    if($thumb['src']) {
        $img = $thumb['src'];
        $thumb['alt'] = $list[$i]['subject'];
        $noImage = '';
        $youtube_content = '';
    } else {
        if($youtubeID[2] == "youtu.be") {
            $youtube_content = '<sup class="youtube_img" style="background-image:URL(https://img.youtube.com/vi/'.$youtubeID[3].'/sddefault.jpg" alt="'.$list[$i]['subject'].');"></sup>
        ';
        } 
        
        $thumb['alt'] = 'No image';
        $noImage = '<u>No image</u>';
    }
    $img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
    ?>
       <div class="test_wrap_list">
            <div class="test_slider">
                <div class="test_list">
                    <img src="<?php echo $img?>">
                </div>
            </div>
            <div class="test_direction">
                <div class="page_info "></div>
            </div>
        </div>
    <?php }  ?>
    <?php if (count($list) == 0) { //게시물이 없을 때  ?>
   
    <?php }  ?>
 

 

저기 .test_list 부분이 이미지 나오는곳인데 어떻게 수정해야 첫번째 첨부파일말고,

이미지 첨부한대로 전부 나올수있게 할지 잘모르겠습니다 ㅠㅠㅠ

이 질문에 댓글 쓰기 :

답변 1


<?php

for ($i=0; $i<count($list); $i++) {
  ...코드
  $this_file = get_file($bo_table, $list[$i]['wr_id'];
  print_r ($this_file);
  ...코드
}

?>

 

print_r ($this_file); 이 값이 제대로 찍혀 나온다면 배열에서 필요한 것들만 가져가시면 됩니다.


    <?php
    for ($i=0; $i<count($list); $i++) {
    $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
    $youtubeID = $list[$i]['wr_link1']; 
    $youtubeID = explode('/',$youtubeID); 
    if($thumb['src']) {
        $img = $thumb['src'];
        $thumb['alt'] = $list[$i]['subject'];
        $noImage = '';
        $youtube_content = '';
    } else {
        if($youtubeID[2] == "youtu.be") {
            $youtube_content = '<sup class="youtube_img" style="background-image:URL(https://img.youtube.com/vi/'.$youtubeID[3].'/sddefault.jpg" alt="'.$list[$i]['subject'].');"></sup>
        ';
        } 
        
        $thumb['alt'] = 'No image';
        $noImage = '<u>No image</u>';
    }
    $img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';
    // 여기서 들어갑니다.
    $this_file = get_file($bo_table, $list[$i]['wr_id'];
    print_r ($this_file);
    ?>
       <div class="test_wrap_list">
            <div class="test_slider">
                <div class="test_list">
                    <img src="<?php echo $img?>">
                </div>
            </div>
            <div class="test_direction">
                <div class="page_info "></div>
            </div>
        </div>
    <?php }  ?>
    <?php if (count($list) == 0) { //게시물이 없을 때  ?>
   
    <?php }  ?>


다만 지금 .test_list 안에 print_r 로 찍은 $this_file 배열 안에 있는 이미지들을 넣으실거면 썸네일 부르는 코드들은 삭제하시고 test_list를 반복문으로 한번 더 돌리셔야됩니다.

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

회원로그인

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