Extra Form
PHP PHP 7.4
CMS Rhymix 2.0

안녕하세요

 

일전에 

 

https://xetown.com/questions/1685046

 

위 글에서 문의 드려서 답변 받은 방법으로

 

게시판 목록에서 최초 첫번째 게시물에서만 썸네일을 출력하는 방법을 사용 했었는데요

 

오늘 다른 변경사항이 없는데 출력이 안되서요

다른 스킨에 적용해봐도 도통 해결이 안되서 다시 한번 문의 드려봅니다 ㅜㅜ

 

 

람보님께서 설명해주신 방법

 

위 방법대로 하지말고

어차피 반복문은 몇번 돌리던 상관없으니 썸네일이 있는 이미지의 제일 첫번째 데이터만 가져오도록 하면되겠습니다.

 

해당 스킨 출력하는 부분 위에서

<!--@foreach($documents as $no => $document)-->
<!--@if($document->getThumbnail())-->
{
$firstTh = $document->getThumbnail;
braek;
}
<!--@end-->
<!--@end-->
이렇게 해서

<!--@if($firstTh)-->
이미지 출력
<!--@end-->

뭐 이런식?

 

테스트는 안해봣는데 템플릿에서 break가 안먹히면 그냥 $fristTh가  있으면 continue 으로 넘어가게 하거나 등등.. 방법은 많이있긴합니다.

 

상황에 따라 골라서 구현하시면 되겠습니다.

 

위 방법대로 하면 목록 게시판 전체 썸네일이 모두 사라지더라구요 ㅜㅜ

 

 

 

윤삼님께서 설명해주신 방법

       

<li loop="$document_list=>$no,$document">
<!--@if(($total_count - $no) % $module_info->list_count === 0 && $list_config['thumbnail'] && $document->thumbnailExists())-->
<img src="{$document->getThumbnail()}" />
<!--@end-->
블라블라~~ 기타 문서 정보들
</li>

 

위 방법대로 적용하니

 

DivisionByZeroError #0 "Modulo by zero" in modules/board/skins/eoshub/templates/card/card-item.html on line 34

 

이런 에러가 발생해버리네요 

그전에는 잘되었는데 ㅜㅜ

 

 

 

 

현재 제 사이트에 적용된 코드 입니다

 

{@

  // 썸네일 크기

  $post_item_thumbnail_width = '240px';

  $post_item_thumbnail_height = '160px';

 

  if($mi->card_thumb_width)

    $post_item_thumbnail_width = $mi->card_thumb_width;

  if($mi->card_thumb_height)

    $post_item_thumbnail_height = $mi->card_thumb_height;

 

  if($mi->card_thumb_blur == 'Y')

    $post_item_blur = 'app-post-item--blur';

}

 

<li loop="$document_list=>$no,$document">

  <div class="app-post-item-wrap">

    {@

      // 아이템 타입

      $post_item_type = 'app-post-item--base';

      if(!$document->thumbnailExists()) // 썸네일이 없을 때

       $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

      elseif(in_array('secret', $document->getExtraImages())) // 비밀글일 때

        $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

      elseif(!$document->getSummary(80)) // 요약글이 없을 때

        $post_item_type = 'app-post-item--image'; // 이미지 타입으로 지정


 

      // 비밀글 상태

      $post_item_secret = '';

      if(in_array('secret', $document->getExtraImages()))

        $post_item_secret = 'app-post-item--secret';

    }

   

    <a class="app-post-item {$post_item_type} {$post_item_secret} {$post_item_blur}" href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">

      <include target="card-item-status.html" />

 

      {@ // 썸네일 영역 }

      <!--@if($document->thumbnailExists() && !$post_item_secret)-->

      <div class="app-post-item__thumbnail">

 

        <!--@if(($total_count - $no) % $module_info->list_count === 0 && $list_config['thumbnail'] && $document->thumbnailExists())-->

        <img src="{$document->getThumbnail($module_info->card_thumb_width, 'auto', 'ratio')}"/>

      <!--@end-->

 

이하 스킨 내용물들

블라블라

 

 

 

여기에서 잘못된 내용이 있을까요? ㅜㅜ

 

읽어봐주셔서 감사합니다!

 

 

  • profile
    저기 % 앞뒤로 숫자가 0으로 나온다면 문제가 발생되는겁니다.

    DivisionByZeroError 자체가 숫자를 0으로 나눌수 없다는 그런 에러거든요.

    앞뒤의 숫자가 어떻게 나오는지 변수자체에서 확인하고 디버깅 해봐야 합니다.
  • profile profile
    흠..

    일전에 윤삼님께서 알려주신 코드로 적용이 잘되었는데 갑자기 저러네요 흠.. ㅜㅜ
  • profile profile
    <li loop="$document_list=>$no,$document">
    <!--@if(($total_count - $no) % $module_info->list_count === 0 && $list_config['thumbnail'] && $document->thumbnailExists())-->
    <img src="{$document->getThumbnail()}" />
    <!--@end-->
    블라블라~~ 기타 문서 정보들
    </li>

    윤삼님께서 알려주신 코드인데 이전에는 정상 출력이 되었던 부분인데

    현재 게시글에 있는 제 코드 기준으로 수정해야할 부분이 있다는 말씀이신지요?
  • profile
    DivisionByZeroError 면, 조건문에서 분자가 0이 되면 안 된다는 뜻인가봐요.
    이렇게 해보시죠.
    <!--@if($total_count - $no > 0 && ($total_count - $no) % $module_info->list_count === 0 && $list_config['thumbnail'] && $document->thumbnailExists())-->

    그리고 람보님 소스가 가장 깔끔한데,

    <!--@foreach($documents as $no => $document)-->
    <!--@if($document->getThumbnail())-->
    {
    $firstTh = $document->getThumbnail;
    braek;
    }
    <!--@end-->
    <!--@end-->

    변수를 정의하는 소스는 반복문 이전에, 예컨대 파일 맨 앞 같은 위치에 두고,

    <!--@if($firstTh)-->
    이미지 출력
    <!--@end-->

    이미지 출력 소스는 섬네일 출력 영역에 두시면 될 것 같아요.
  • profile profile

    답변 감사합니다 윤삼님!

     

    일단 윤삼님이 알려주신 방법대로

     

    {@

      // 썸네일 크기

      $post_item_thumbnail_width = '240px';

      $post_item_thumbnail_height = '160px';

     

      if($mi->card_thumb_width)

        $post_item_thumbnail_width = $mi->card_thumb_width;

      if($mi->card_thumb_height)

        $post_item_thumbnail_height = $mi->card_thumb_height;

     

      if($mi->card_thumb_blur == 'Y')

        $post_item_blur = 'app-post-item--blur';

    }

     

    <li loop="$document_list=>$no,$document">

      <div class="app-post-item-wrap">

        {@

          // 아이템 타입

          $post_item_type = 'app-post-item--base';

          if(!$document->thumbnailExists()) // 썸네일이 없을 때

           $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(in_array('secret', $document->getExtraImages())) // 비밀글일 때

            $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(!$document->getSummary(80)) // 요약글이 없을 때

            $post_item_type = 'app-post-item--image'; // 이미지 타입으로 지정


     

          // 비밀글 상태

          $post_item_secret = '';

          if(in_array('secret', $document->getExtraImages()))

            $post_item_secret = 'app-post-item--secret';

        }

       

        <a class="app-post-item {$post_item_type} {$post_item_secret} {$post_item_blur}" href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">

          <include target="card-item-status.html" />

     

          {@ // 썸네일 영역 }

          <!--@if($document->thumbnailExists() && !$post_item_secret)-->

          <div class="app-post-item__thumbnail">

            <!--@if($total_count - $no > 0 && ($total_count - $no) % $module_info->list_count === 0 && $list_config['thumbnail'] && $document->thumbnailExists())-->

            <img src="{$document->getThumbnail($module_info->card_thumb_width, 'auto', 'ratio')}"/>

            <!--@end-->

          </div>

     

    윤삼님께서

    알려주신대로 빨간색 부분에 저렇게 적용을 했는데

    이번에는 에러는 안생기긴 하는데 목록에 썸네일만 모두 출력이 안되는 현상이 발생해서요

     

    추가로 람보님 코드부분 알려주신 부분도 적용 해봤는데

     

    {@

      // 썸네일 크기

      $post_item_thumbnail_width = '240px';

      $post_item_thumbnail_height = '160px';

     

      if($mi->card_thumb_width)

        $post_item_thumbnail_width = $mi->card_thumb_width;

      if($mi->card_thumb_height)

        $post_item_thumbnail_height = $mi->card_thumb_height;

     

      if($mi->card_thumb_blur == 'Y')

        $post_item_blur = 'app-post-item--blur';

    }

     

    <!--@foreach($documents as $no => $document)-->

    <!--@if($document->getThumbnail())-->

    {

      $firstTh = $document->getThumbnail;

      braek;

      }

      <!--@end-->

      <!--@end-->

     

    <li loop="$document_list=>$no,$document">

      <div class="app-post-item-wrap">

        {@

          // 아이템 타입

          $post_item_type = 'app-post-item--base';

          if(!$document->thumbnailExists()) // 썸네일이 없을 때

           $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(in_array('secret', $document->getExtraImages())) // 비밀글일 때

            $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(!$document->getSummary(80)) // 요약글이 없을 때

            $post_item_type = 'app-post-item--image'; // 이미지 타입으로 지정


     

          // 비밀글 상태

          $post_item_secret = '';

          if(in_array('secret', $document->getExtraImages()))

            $post_item_secret = 'app-post-item--secret';

        }

       

        <a class="app-post-item {$post_item_type} {$post_item_secret} {$post_item_blur}" href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">

          <include target="card-item-status.html" />

     

          {@ // 썸네일 영역 }

          <!--@if($document->thumbnailExists() && !$post_item_secret)-->

          <!--@if($firstTh)-->

          <div class="app-post-item__thumbnail">

            <img src="{$document->getThumbnail($module_info->card_thumb_width, 'auto', 'ratio')}"/>

          </div>

          <!--@end-->

     

    윤삼님 코드와 같이 게시판 목록에서 출력되던 썸네일만 모두 출력이 안되는 현상이 발생하네요;;

     

    추가로 수정해야할 부분이 있을까요?

     

    소중한 답변 감사합니다!

  • profile

    1. 게시물 목록에서,
    2. 이미지가 첨부된 (비밀글이 아닌) 첫번째 게시물을 찾아서,
    3. 그 게시물에서만 getThumbnail을 한다.

     

    이걸 원하고 계신데, 질문글 본문의 빨간색 부분의 코드는 이런 목적이 아닌 것 같습니다. 람보님 코드처럼 해야겠죠 (이곳에 글 옮겨적으면서 오타난 것이고 실제 코드에서는 braek가 아닌 break로 쓰고 있으시겠죠?)

     

    그리고, 가능하면 thumbnailExist()를 호출할때는, getThumbnail()을 호출할때와 parameter를 동일하게 해주는 것이 효율적일 것 같습니다. 그래야 섬네일을 2중으로 만들지 않을테니까요. 즉, $document->thumbnailExist($module_info->card_thumb_width, 'auto', 'ratio') 로 호출해주는 것이 좋겠죠. parameter 없이 그냥 호출하면 쓰지도 않을 폭 80 픽셀짜리 썸네일을 만들어 보는 것이니까요.

  • profile profile

    {@

      // 썸네일 크기

      $post_item_thumbnail_width = '240px';

      $post_item_thumbnail_height = '160px';

     

      if($mi->card_thumb_width)

        $post_item_thumbnail_width = $mi->card_thumb_width;

      if($mi->card_thumb_height)

        $post_item_thumbnail_height = $mi->card_thumb_height;

     

      if($mi->card_thumb_blur == 'Y')

        $post_item_blur = 'app-post-item--blur';

    }

     

    <!--@foreach($documents as $no => $document)-->

     

    <!--@if($document->getThumbnail())-->

     

    {

     

      $firstTh = $document->getThumbnail;

     

      break;

     

      }

     

      <!--@end-->

     

      <!--@end-->

     

    <li loop="$document_list=>$no,$document">

      <div class="app-post-item-wrap">

        {@

          // 아이템 타입

          $post_item_type = 'app-post-item--base';

          if(!$document->thumbnailExists()) // 썸네일이 없을 때

           $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(in_array('secret', $document->getExtraImages())) // 비밀글일 때

            $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(!$document->getSummary(80)) // 요약글이 없을 때

            $post_item_type = 'app-post-item--image'; // 이미지 타입으로 지정


     

          // 비밀글 상태

          $post_item_secret = '';

          if(in_array('secret', $document->getExtraImages()))

            $post_item_secret = 'app-post-item--secret';

        }

       

        <a class="app-post-item {$post_item_type} {$post_item_secret} {$post_item_blur}" href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">

          <include target="card-item-status.html" />

     

          {@ // 썸네일 영역 }

          <!--@if($document->thumbnailExists() && !$post_item_secret)-->

    <!--@if($firstTh)-->

     

    <div class="app-post-item__thumbnail">

     

      <img src="{$document->thumbnailExist($module_info->card_thumb_width, 'auto', 'ratio')}"/>

     

    </div>

     

    <!--@end-->

     

    위 상태에서도 게시판 목록 전체 썸네일만 출력이 안되는데 추가로 수정해야할 부분이 있을까요?

     

    답변 감사합니다!

  • profile profile

        $firstTh = $document->getThumbnail;

        $firstTh = no;
    로,

        if ($firstTh)

        if ($firstTh == no)
    같은 식으로 되어야 겠죠.

  • profile profile

    답변 감사합니다

     

    <!--@foreach($documents as $no => $document)-->
    <!--@if($document->getThumbnail())-->
    {@
      $firstTh = no;
      break;
      }
      <!--@end-->
      <!--@end-->

     

            <!--@if($firstTh == no)-->

    내용

            <!--@end-->

     

    제가 이해가 잘못된건지 모르겠는데 이렇게 진행을 해봤는데 똑같이 썸네일만 목록에서 전체가 출력이 안되서요

    어디 잘못된 부분이 있을까요?

  • profile profile
    “내용” 이란 부분에 getThumbnail(….…)로 쓰신것 맞죠?
  • profile profile
    내용이라는 부분에

    <img src="{$document->getThumbnail($module_info->card_thumb_width, 'auto', 'ratio')}"/>

    이걸 넣었는데 잘못된 부분 있을까요??
  • profile profile

    <!--@end-->

    <!--@end-->

    아래쪽에

    <p> $firstTh = {$firstTh}</p>
    이렇게 해서, $firstTh 가 제대로 계산되는지 디버깅 해보셔야 할것 같습니다. 화면에 뭐라 나오는지...

  • profile profile
    알려주신대로 해봤더니

    $firstTh =

    썸네일이 있던 게시물 출력위치에 저렇게만 출력이 되더라구요
  • profile

    <!--@foreach($documents as $no => $document)-->
    <!--@if($document->getThumbnail())-->
    {@
    $firstTh = $document->getThumbnail();
    break;
    }
    <!--@end-->
    <!--@end-->

    으로 해야 할 것 같네요;;;

  • profile profile

    먼저 답변 감사드리며

     

    윤삼님께서 알려주신 방법대로 람보님 코드를 작성해봤는데요

     

     

    <!--@foreach($documents as $no => $document)-->

    <!--@if($document->getThumbnail())-->

    {@

      $firstTh = $document->getThumbnail();

      break;

      }

      <!--@end-->

      <!--@end-->

     

    {@

      // 썸네일 크기

      $post_item_thumbnail_width = '240px';

      $post_item_thumbnail_height = '160px';

     

      if($mi->card_thumb_width)

        $post_item_thumbnail_width = $mi->card_thumb_width;

      if($mi->card_thumb_height)

        $post_item_thumbnail_height = $mi->card_thumb_height;

     

      if($mi->card_thumb_blur == 'Y')

        $post_item_blur = 'app-post-item--blur';

    }

     

    <li loop="$document_list=>$no,$document">

      <div class="app-post-item-wrap">

        {@

          // 아이템 타입

          $post_item_type = 'app-post-item--base';

          if(!$document->thumbnailExists()) // 썸네일이 없을 때

           $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(in_array('secret', $document->getExtraImages())) // 비밀글일 때

            $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(!$document->getSummary(80)) // 요약글이 없을 때

            $post_item_type = 'app-post-item--image'; // 이미지 타입으로 지정


     

          // 비밀글 상태

          $post_item_secret = '';

          if(in_array('secret', $document->getExtraImages()))

            $post_item_secret = 'app-post-item--secret';

        }

       

        <a class="app-post-item {$post_item_type} {$post_item_secret} {$post_item_blur}" href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">

          <include target="card-item-status.html" />

     

          {@ // 썸네일 영역 }

          <!--@if($document->thumbnailExists() && !$post_item_secret)-->

          <div class="app-post-item__thumbnail">

            <!--@if($firstTh)-->

            <img src="{$document->getThumbnail($module_info->card_thumb_width, 'auto', 'ratio')}"/>

            <!--@end-->

          </div>

     

     

    코드 오류는 없는데 게시물 목록 전체의 썸네일이 출력이 안되는 현상이 발생되서요

    어디 추가로 수정해야할 부분이 있을까요?

     

    감사합니다!

  • profile profile

    아래에
    <!--@if($firstTh)-->
    <!--@end-->
    부분을 넣으면
    당연히 처음 썸네일일 경우에만 들어가고.. 나머지 썸네일이 안나올텐데요?

    첫번째 게시글일때라는 조건을 따로 구분하셔야죠.

    이건 진짜 하나씩 개발해가면서 저나 윤삼님도 테스트해가면서 개발해야하는 영역이라 이렇게 글로써는 힘들듯합니다.-_-;

    암튼

    $firstTh는 첫번째 썸네일이 있다는 것을 의미하는 것이고 썸네일의 크기가 필요시 위에

    <!--@foreach($documents as $no => $document)-->
    <!--@if($document->getThumbnail())-->
    {@
    $firstTh = $document->getThumbnail($module_info->card_thumb_width, 'auto', 'ratio');
    break;
    }
    <!--@end-->
    <!--@end-->
    이렇게 미리 썸네일의 크기도 잡아주는게 필요하겠지요.

    그래서

    <!--@if($firstTh)-->
    <img src="{$firstTh}"/>
    <!--@end-->

    이게 맞을꺼고

    그외 구현되는건 계속 봐야할듯합니다.

     

    그 외 필요한 부분은 도메인 공개부터...-_-

  • profile profile

    안녕하세요 람보님!

     

    말씀해주신대로 해봤는데 게시물 목록에서 썸네일 지속 출력이 안되서요

    깜빡하고 도메인 주소를 공개를 못했네요 죄송합니다^^;

     

    도메인 주소 : https://voiceits.net/bbstext

     

    알려주신 코드는 아래와 같이 적용을 해봤습니다!

    확인 한번 해주시면 감사해요!

     

    언제나 감사합니다 람보님!

     

    {@

        if(!$mi->thumb_count) $mi->thumb_count = 1;

        if($mi->thumb_count > 2 && $_is_mobile) $mi->thumb_count = 2;

        if(!$mi->thumb_type) $mi->thumb_type = 'crop';

        if(!$mi->thumb_ratio) $mi->thumb_ratio = 63;

        $_is_mobile?$_thumb_s = 15:$_thumb_s = 25;

        $_thumb_space = $_thumb_s*($mi->thumb_count-1);

        $_is_mobile?$_thumb_width = round(750/$mi->thumb_count, 2):$_thumb_width = round(($layout_info->layout_width-$_thumb_space)/$mi->thumb_count, 2);

        if($mi->thumb_type == 'ratio'):

            $_thumb_height = 'auto';

        else:

            $_thumb_height = round($_thumb_width*($mi->thumb_ratio/100), 2);

        endif;

        if(!$mi->subject_cut_size) $mi->subject_cut_size = 90;

        if(!$mi->content_cut_size) $mi->content_cut_size = 250;

        $_has_profile = $list_config['nick_name'] && $mi->show_list_profile;

        if($_is_mobile):

            $_show_category = $mi->use_category == 'Y' && !$mi->show_category;

        else:

            $_show_category = $mi->use_category == 'Y' && $mi->show_category != 'N';

        endif;

    }

     

    <!--@foreach($documents as $no => $document)-->

    <!--@if($document->getThumbnail())-->

    {@

        $firstTh = $document->getThumbnail($module_info->card_thumb_width, 'auto', 'ratio');

        break;

        }

        <!--@end-->

        <!--@end-->

     

    <!--@if($mi->thumb_count > 1)-->

    <load target="./js/packery.min.js" />

    <load target="./js/imagesloaded.pkgd.min.js" />

    <style>

    .ldb    {padding-bottom: 0 !important;}

    .ldb .list_unit {margin-bottom: 0;}

    </style>

    <!--@end-->

    <include target="_list_notice.html" cond="$notice_list" />

    <div class="ldb<!--@if($notice_list)--> has_notice<!--@end--><!--@if($mi->use_bnw == 'Y')--> use_bnw<!--@end--><!--@if($_has_profile)--> has_profile<!--@end--><!--@if($mi->thumb_count > 2)--> small_size<!--@end--><!--@if($mi->thumb_count > 1)--> mobile_size<!--@end-->" cond="$document_list">

        <ul>

        <!--@foreach($document_list as $no => $document)-->

        {@

            $x_date = strtotime($document->getRegdate('YmdHi'));

            $time_calc = time() - $x_date;

            $has_thumb = $document->thumbnailExists() && !$document->isSecret() && $list_config['thumbnail'];

        }

        <!--@if($mi->normal_date)-->

        {@ $_atc_date = $document->getRegdate('y.m.d.'); }

        <!--@else-->

            <!--@if($time_calc < 60)-->{@ $_atc_date = '방금'}

            <!--@elseif($time_calc >=60 && $time_calc < 3600)-->{@ $_atc_date = floor($time_calc/60).'분 전'}

            <!--@elseif($time_calc>=3600 && $time_calc < 86400)-->{@ $_atc_date = floor($time_calc/3600).'시간 전'}

            <!--@elseif($time_calc>=86400 && $time_calc < 604800)-->{@ $_atc_date = floor($time_calc/86400).'일 전'}

            <!--@else-->{@ $_atc_date = $document->getRegdate('y.m.d.')}<!--@end-->

        <!--@end-->

        <li class="list_unit" style="display: inline-block; width: <!--@if(!$_is_mobile)-->{$_thumb_width}px<!--@end-->;"|cond="$mi->thumb_count > 1">

            {@

                $x_date = strtotime($document->getRegdate('YmdHi'));

                $z_date = strtotime(zdate($document->get('last_update'),'YmdHi'));

                $time_calc = time() - $x_date;

                $_new_atc = $x_date > $y_date; $updated = $z_date > $y_date;

                $_updated = $z_date > $y_date;

            }

            <!--@if($mi->normal_date)-->

            {@ $_atc_date = $document->getRegdate('y.m.d.'); }

            <!--@else-->

                <!--@if($time_calc < 60)-->{@ $_atc_date = '방금'}

                <!--@elseif($time_calc >=60 && $time_calc < 3600)-->{@ $_atc_date = floor($time_calc/60).'분 전'}

                <!--@elseif($time_calc>=3600 && $time_calc < 86400)-->{@ $_atc_date = floor($time_calc/3600).'시간 전'}

                <!--@elseif($time_calc>=86400 && $time_calc < 604800)-->{@ $_atc_date = floor($time_calc/86400).'일 전'}

                <!--@else-->{@ $_atc_date = $document->getRegdate('y.m.d.')}<!--@end-->

            <!--@end-->

            <span class="pf round" cond="$_has_profile"><img class="pf_img" src="{$document->getProfileImage()}" alt="{$document->getNickName()}" cond="$document->getProfileImage()" /></span>

            <label class="i_check" cond="$grant->manager && $mi->admin_checkbox != 'N'"><input type="checkbox" name="cart" value="{$document->document_srl}" title="Check This Article" onclick="doAddDocumentCart(this)" checked="checked"|cond="$document->isCarted()" /><span><span>✓</span></span></label>

            <block cond="$mi->show_icon != 'N'">

            <!--@if($_new_atc)-->

            <span class="list_new">N</span>

            <!--@elseif($_updated)-->

            <span class="list_new updated">U</span>

            <!--@end-->

            </block>

            <a href="{getUrl('document_srl', $document->document_srl,'comment_srl','','cpage','')}" class="list_thumb" cond="$document->getThumbnail()">

               

            <!--@if($firstTh)-->

            <img src="{$firstTh}"/>

            <!--@end-->

           

  • profile profile

    ?님 뭔가 좀 착각 하시고 구현하시는듯 합니다.
     

    아래 내용 다시한번 질문에 대한 부분을 생각해보시기 바랍니다.

    1. 첫번째 썸네일만 이미지를 뽑는 이유는?
    2. 첫번째 썸네일이 해당 썸네일에 출력해주는 것이 절대 아님.
    3. 썸네일의 위치라던지 이런 부분이 정확하게 어떻게 구현이 필요한건지?

    님이 원하는 구상을 다시한번 더 확인해봐야할거같은데요?

    실제로 이론상의 코드는 맞고, 이미지 출력하는 부분은 게시글 리스트 부분이 아니라 게시글 리스트전이나 뭐 기타 위치에 해당 이미지를 출력해주는거고,

    이미지 자체가 생성이 안되고 캐시파일만 생성되어 이미지가 안뜬다면 그 첫번째 썸네일 자체도 재대로 로딩이 안됬으니 files안에 썸네일 폴더를 지우고 새롭게 재생성 되도록 해봐야합니다.

    이런 작업은 단순히 코드만 보고 님 사이트만 보는것 자체로도 힘들고.. 의뢰영역이 맞을듯 하네요.

  • profile profile

    화면 캡처 2022-05-12 133314.png

     

    네 람보님

     

    1. 첫번째 썸네일만 이미지를 뽑는 이유는?

     

    최초 문의 드렸던 글은

    이전 글

    https://xetown.com/questions/1685046

     

    위 이미지 처럼 게시물 목록의 가장 최근 글 1개에 대해서만 썸네일 출력하는 방법을 문의드렸던 부분 입니다

    참고 사이트 : https://dev.to/

     

     

    2. 첫번째 썸네일이 해당 썸네일에 출력해주는 것이 절대 아님.

    3. 썸네일의 위치라던지 이런 부분이 정확하게 어떻게 구현이 필요한건지?

     

    2.3 번의 답변도 위에 설명으로 된것 같아서요

     

    이전 문의 글에서 람보님과 윤삼님께서 알려주신 코드중

    윤삼님께서 알려주신 코드를 적용했더니 

     

    참고 사이트 : https://dev.to/

    처럼 게시물 목록의 최근 글 1개에 대해서만 썸네일이 나오는게 됬었는데요

     

    이후 다시 해보려고 시도 했는데 안되서 문의를 드리게 되었습니다^^;;

     

    답변 감사합니다

     

     

     

  • profile profile

    썸네일 생성 여부부터 다시 점검 해보셔야 할듯합니다.

     

    제가 드린 소스를 충분히 활용만 잘하신다면 충분히 생성이 가능하시겟지만.

     

    한가지 알아두실부분은 첫번째 게시글의 섬네일이 없을때 두번째 게시글의 썸네일이 첫번째 섬네일으로 인식하여 가져올수도 있다는점도 있으니 if문 빡세게 생각하셔서 구현하시면 되겠네요..

     

    제가 드릴 수 있는 부분은 여기 힌트까지 거의다 드린듯 합니다.

  • profile profile
    네 바쁘신데 답변 감사합니다

    말씀해주신 부분부터 확인해봐야겠네요
  • profile
    제가 권했던 코드로 첫 페이지뿐 아니라 다른 페이지에서도 썸네일이 안 나오나요?
    생각을 좀 해봤는데, 첫 페이지를 제외하고 그 외의 페이지에서는 첫 번째 게시물의 썸네일만 잘 추출할 것 같거든요.
    암튼 url이 있어야 더 원활한 답을 얻을 수 있는 건 분명할 듯합니다;;;
  • profile profile

    안녕하세요 윤삼님!

    말씀해주신 방법으로 진행하고 첫페이지 말고 2번 페이지를 확인해 봤는데


    2페이지에서도 동일하게 썸네일 전체가 출력이 안되서요^^;

     

    도메인 주소를 공개를 못했네요 죄송합니다^^;

    https://voiceits.net/eh_kin

     

    바쁘실텐데 답변 감사드립니다

     

    아래는 알려주신 방법으로 현재 작성된 코드 입니다

     

    확인 한번만 부탁드릴께요!

     

    감사합니다!

     

    {@

      // 썸네일 크기

      $post_item_thumbnail_width = '240px';

      $post_item_thumbnail_height = '160px';

     

      if($mi->card_thumb_width)

        $post_item_thumbnail_width = $mi->card_thumb_width;

      if($mi->card_thumb_height)

        $post_item_thumbnail_height = $mi->card_thumb_height;

     

      if($mi->card_thumb_blur == 'Y')

        $post_item_blur = 'app-post-item--blur';

    }

     

    <li loop="$document_list=>$no,$document">

      <div class="app-post-item-wrap">

        {@

          // 아이템 타입

          $post_item_type = 'app-post-item--base';

          if(!$document->thumbnailExists()) // 썸네일이 없을 때

           $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(in_array('secret', $document->getExtraImages())) // 비밀글일 때

            $post_item_type = 'app-post-item--text'; // 텍스트 타입으로 지정

          elseif(!$document->getSummary(80)) // 요약글이 없을 때

            $post_item_type = 'app-post-item--image'; // 이미지 타입으로 지정


     

          // 비밀글 상태

          $post_item_secret = '';

          if(in_array('secret', $document->getExtraImages()))

            $post_item_secret = 'app-post-item--secret';

        }

       

        <a class="app-post-item {$post_item_type} {$post_item_secret} {$post_item_blur}" href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">

          <include target="card-item-status.html" />

     

          {@ // 썸네일 영역 }

          <!--@if($document->thumbnailExists() && !$post_item_secret)-->

          <div class="app-post-item__thumbnail">

            <!--@if($total_count - $no > 0 && ($total_count - $no) % $module_info->list_count === 0 && $list_config['thumbnail'] && $document->thumbnailExists())-->

            <img src="{$document->getThumbnail($module_info->card_thumb_width, 'auto', 'ratio')}"/>

            <!--@end-->

          </div>

    이하 내용

     

  • profile profile
    댓글로 이야기된 소스가 제대로 된 것인지, 적용은 잘 된 것인지, 그리고 질문답변에서 이야기된 것 말고 다른 이슈가 있는 것인지, 등등 점검이 필요할 것 같네요ㅜㅜ
  • profile profile
    네 윤삼님

    답변 감사드리며

    이전 글에서 처음 알려주셨던 내용으로 잘 적용이 되었던 와중에
    https://xetown.com/questions/1685046

    어제 다시금 구현을 시도해봤는데 에러가 발생되어 문의드리게 되었습니다

    바쁘신데 감사합니다
  • ?
    윤삼님의 코드를 적용하니 스케치북 게시판에서 잘 작동되는데요.
    스케치북 게시판에 "첫 게시글만 썸네일 출력" 스킨을 추가해 보았습니다.
    https://dev.to 에 거의 비슷하게 꾸며 보았습니다.
    https://moonhouse.co.kr/xemy/530374
  • ? profile
    네 저도 처음엔 잘되다가 다시 적용해보니 안되서요^^a
    답변 감사합니다~