테스트 사이트 - 개발 중인 베타 버전입니다

그룹 최신글 리스트 이미지 질문 드립니다. 채택완료

탐크루지 6개월 전 조회 1,516

예전에 2015년정도의 포퓨리 님이 등록해주신 스킨을 보고서 약간식 수정해서 그룹 최신리스트를 해보고 있습니다. 

리스트는 잘 가지고 오는데 이미지를 잘 못가지고 와서요.. ㅠㅠ 

이미지를 가져오는데 도움주시면 감사하겠습니다. 

 

latest.skin.php

</p>

<p><?php</p>

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

include_once(G5_LIB_PATH . '/thumbnail.lib.php');

$imgwidth = "640"; //표시할 이미지의 가로사이즈

$imgheight = "780"; //표시할 이미지의 세로사이즈

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨

add_stylesheet('<link rel="stylesheet" href="' . $latest_skin_url . '/style.css">', 1);</p>

<p>?></p>

<p><div class="lt" data-aos="fade-up" data-aos-delay="600">

  <strong class="lt_title"><a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $bo_table ?>"><?php echo $bo_subject; ?></a></strong>

  <div class="owl-carousel owl-theme latest-carousel">

    <?php for ($i = 0; $i < count($list); $i++) {  ?>

      <div class="a-item">

        <a href="<?= $list[$i]['href'] ?>" class="info">

          <?php

          $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $imgwidth, $imgheight, false, true);

          $img_content = 'NO IMAGE';

          if ($thumb['src']) {

            $img_content = '<img src="' . $thumb['src'] . '" alt="' . $list[$i]['subject'] . '">';

          }

          echo '<div class="img-box">';

          echo $img_content;

          echo '<div class="bg"></div>';

          echo '</div>';

          ?>

          

          <div class="txt_box clearfix">

            <div class="subject">

              <?php //제목

              if ($list[$i]['is_notice'])

                echo "<strong>" . $list[$i]['subject'] . "</strong>";

              else

                echo $list[$i]['subject'];

              ?>

              <?php //댓글수

              if ($list[$i]['comment_cnt'])

                echo $list[$i]['comment_cnt'];

              ?>

            </div>

            <!--<div class="substance">

              <?php //내용    

              if (!$options['content_length']) $options['content_length'];

              echo cut_str(strip_tags($list[$i]['wr_content']), $options['content_length']);

              ?>

            </div>-->

        </a>

        <input type="button" class="more" value="자세히 보기" onClick="location.href='<?php echo $list[$i]['href'] ?>'">

      </div>

      <?php

      // echo $list[$i]['icon_reply']." ";

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

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

      //if (isset($list[$i]['icon_new'])) echo " " . $list[$i]['icon_new'];

      //if (isset($list[$i]['icon_hot'])) echo " " . $list[$i]['icon_hot'];

      //if (isset($list[$i]['icon_file'])) echo " " . $list[$i]['icon_file'];

      //if (isset($list[$i]['icon_link'])) echo " " . $list[$i]['icon_link'];

      //if (isset($list[$i]['icon_secret'])) echo " " . $list[$i]['icon_secret'];

      ?>

  </div>

<?php }  ?></p>

<p><?php if (count($list) == 0) { //게시물이 없을 때 ?>

  <div>게시물이 없습니다.</div>

<?php }  ?>

</div>

<div class="lt_more"><a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $bo_table ?>"><span class="sound_only"><?php echo $bo_subject ?></span>더보기</a></div>

</div>

<script></p>

<p>  $('.latest-carousel').owlCarousel({</p>

<p>    loop: true,</p>

<p>    margin: 30,</p>

<p>    nav: false,</p>

<p>    dots: false,</p>

<p>    navSpeed: 700,</p>

<p>    navText: ['PREV', 'NEXT'],</p>

<p>    autoplay: true,</p>

<p>    autoplayTimeout: 4000,</p>

<p>    smartSpeed: 1000, // 슬라이드 전환 속도 조절</p>

<p>    autoplaySpeed: 1000, // 자동 재생시 슬라이드 전환 속도</p>

<p>    responsive: {</p>

<p>      0: {</p>

<p>        items: 1</p>

<p>      },</p>

<p>      640: {</p>

<p>        items: 2</p>

<p>      },</p>

<p>      1000: {</p>

<p>        items: 3</p>

<p>      },</p>

<p>      1200: {</p>

<p>        items: 4</p>

<p>      },</p>

<p>    }</p>

<p>  })</p>

<p></script></p>

<p><!-- } <?php echo $bo_subject; ?> 최신글 끝 --></p>

<p>

 

라이브러리의 
latest.lib.php

</p>

<p><?php

if (!defined('_GNUBOARD_')) exit;

@include_once(G5_LIB_PATH.'/thumbnail.lib.php');</p>

<p>// 최신글 추출</p>

<p>function latest2($skin_dir='', $gr_id, $rows=10, $subject_len=40, $cache_time=1, $options='')

{

    global $g5;

    //static $css = array();</p>

<p>    if (!$skin_dir) $skin_dir = 'basic';    

    

    if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {

        if (G5_IS_MOBILE) {

            $latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];

            if(!is_dir($latest_skin_path))

                $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];

            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);

        } else {

            $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];

            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);

        }

        $skin_dir = $match[1];

    } else {

        if(G5_IS_MOBILE) {

            $latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;

            $latest_skin_url  = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;

        } else {

            $latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;

            $latest_skin_url  = G5_SKIN_URL.'/latest/'.$skin_dir;

        }

    }</p>

<p>    $cache_fwrite = false;

    if(G5_USE_CACHE) {

        $cache_file = G5_DATA_PATH."/cache/latest-{$gr_id}-{$skin_dir}-{$rows}-{$subject_len}.php";</p>

<p>        if(!file_exists($cache_file)) {

            $cache_fwrite = true;

        } else {

            if($cache_time > 0) {

                $filetime = filemtime($cache_file);

                if($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) {

                    @unlink($cache_file);

                    $cache_fwrite = true;

                }

            }</p>

<p>            if(!$cache_fwrite)

                include($cache_file);

        }

    }</p>

<p>    if(!G5_USE_CACHE || $cache_fwrite) {

        $list = array();

        

        $sql = "select a.*, b.bo_subject, c.gr_subject, c.gr_id from g5_board_new a, g5_board b, g5_group c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = 1 and c.gr_id = '{$gr_id}' and a.wr_id = a. wr_parent order by a.bn_id desc limit 0, {$rows}";

        $result = sql_query($sql);</p>

<p>        for ($i=0; $row=sql_fetch_array($result); $i++) {

        

            $sql = " select * from {$g5['board_table']} where bo_table = '{$row['bo_table']}' ";

            $board = sql_fetch($sql);                    

        

            $tmp_write_table = $g5['write_prefix'].$row['bo_table'];

            $row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_id']}' ");

            

            $list[$i] = $row2;

            $list[$i] = get_list($row2, $board, $latest_skin_url, $subject_len);

            $list[$i]['subject'] = "[".$row['bo_subject']."] ".$list[$i]['subject'];

            $list[$i]['bo_table'] = $row['bo_table'];

            

            // 썸네일 추가

            if($options && is_string($options)) {

                $options_arr = explode(',', $options);

                $thumb_width = $options_arr[0];

                $thumb_height = $options_arr[1];

                $thumb = get_list_thumbnail($bo_table, $row['wr_id'], $thumb_width, $thumb_height, false, true);

                // 이미지 썸네일

                if($thumb['src']) {

                    $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$thumb_width.'" height="'.$thumb_height.'">';

                    $list[$i]['img_thumbnail'] = '<a href="'.$list[$i]['href'].'" class="lt_img">'.$img_content.'</a>';

                // } else {

                //     $img_content = '<img src="'. G5_IMG_URL.'/no_img.png'.'" alt="'.$thumb['alt'].'" width="'.$thumb_width.'" height="'.$thumb_height.'" class="no_img">';

                }

            }

            

        }</p>

<p>        if($cache_fwrite) {

            $handle = fopen($cache_file, 'w');

            $cache_content = "<?php\nif (!defined('_GNUBOARD_')) exit;\n\$bo_subject='".$bo_subject."';\n\$list=".var_export($list, true)."?>";

            fwrite($handle, $cache_content);

            fclose($handle);

        }

        

    }</p>

<p>    /*

    // 같은 스킨은 .css 를 한번만 호출한다.

    if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) {

        echo '<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">';

        $css[] = $skin_dir;

    }

    */</p>

<p>    ob_start();

    include $latest_skin_path.'/latest.skin.php';

    $content = ob_get_contents();

    ob_end_clean();</p>

<p>    return $content;

    

}</p>

<p>

 

index.php

</p>

<p>echo  latest2("theme/group_basic", 'product', 100, 50, 1, $options);</p>

<p>

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

답변 1개

채택된 답변
+20 포인트
ifelse
6개월 전

$thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $imgwidth, $imgheight, false, true);

 

$bo_table이 아니라 $list[$i]['bo_table'] 이 들어가야 할것 같습니다. 근데 lib에 다시 보니 이미 썸네일 로직이 있고

$list[$i]['img_thumbnail']로 있는데 중복 생성인거 같습니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

탐크루지
6개월 전
감사합니다. 이미지 잘 나오네요..

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

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

로그인