에디터 첨부 이미지 대신 첨부파일로.

에디터 첨부 이미지 대신 첨부파일로.

QA

에디터 첨부 이미지 대신 첨부파일로.

본문

** 현재 아래의 소스는 슬라이딩 이미지에 관련된 소스입니다. //

** 원본 소스 : https://sir.kr/g5_tip/8895  입니다.

 

------------------------------------------------------------------------------
  <?php
  $list = array();
  $path = array();
  $matches = get_editor_image($view['content'], true);
  if(empty($matches))
        return $contents;

    for($i=0; $i<count($matches[1]); $i++) {

         $img = $matches[1][$i];
        preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img, $m);
        $src = $m[1];
        preg_match("/style=[\"\']?([^\"\'>]+)/i", $img, $m);
        $style = $m[1];
        preg_match("/width:\s*(\d+)px/", $style, $m);
        $width = $m[1];
        preg_match("/height:\s*(\d+)px/", $style, $m);
        $height = $m[1];
        preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $img, $m);
        $alt = get_text($m[1]);
      
     $p = parse_url($matches[1][$i]);
     $data_path = $p['path'];
        $srcfile = G5_PATH.$data_path;
  $filename = basename($srcfile);
        $filepath = dirname($srcfile);

  $list[$i] = $filename;
  $path[$i] = $src;
 }
  ?>

 

--------------------------------------------------------------

 

 

 

** 여기서 -->

------------------------------------------------------------

$matches = get_editor_image($view['content'], true);
  if(empty($matches))
        return $contents;

------------------------------------------------------------

 

위쪽의 부분을 :

----------------------------------------------------------------

$matches = get_view_thumbnail($view['file'][$i]['view']);

  if(empty($matches))
        return $contents;

-----------------------------------------------------------------

이렇게 수정을 했는데  잘안되네요. 에디터 첨부이미지는 되는데요.

에디터 이미지말고 첨부파일로 적용해보려 합니다.

 

 

이 질문에 댓글 쓰기 :

답변 1

skin\board\gallery\view.skin.php 파일에 아래 부분 참조해서 수정하세요.

       
        <?php
        // 가변 파일
        for ($i=0; $i<count($view['file']); $i++) {
            if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
         ?>
            <li>
                <i class="fa fa-folder-open" aria-hidden="true"></i>
                <a href="<?php echo $view['file'][$i]['href'];  ?>" class="view_file_download" download>
                    <strong><?php echo $view['file'][$i]['source'] ?></strong> <?php echo $view['file'][$i]['content'] ?> (<?php echo $view['file'][$i]['size'] ?>)
                </a>
                <br>
                <span class="bo_v_file_cnt"><?php echo $view['file'][$i]['download'] ?>회 다운로드 | DATE : <?php echo $view['file'][$i]['datetime'] ?></span>
            </li>
        <?php
            }
        }
         ?>

답변 감사합니다. 알려주신 소스를 적용해도 안되는데요..
이유가 뭔지 모르겠습니다. ㅠ

for문 아래에 넣어봤구요...
<?php
$list = array();
$path = array();
$matches = get_editor_image($view['content'], true);
if(empty($matches))
        return $contents;

    for($i=0; $i<count($matches[1]); $i++) {

      알려주신 소스 추가  --> for ($i=0; $i<count($view['file']); $i++) {
            if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
...............

그런데요 -> "$matches = get_editor_image($view['content'], true);
" 이부분에 에디터 이미지 대신 파일로 불러오게 하면 되지않을런지요..
그래서 처음에는 "echo get_file_thumbnail($view['file'][$i]);" 이부분으로 해봤는데요.. 안되더라구요..
에디터 이미지 대신 첨부파일 이미지로 불러올 방법이 없을까요? 리스트에서 첨부파일로 되는 동일 스킨은 있지만요..

<?php
        // 파일 출력
        $v_img_count = count($view['file']);
        if($v_img_count) {
            echo "<div id=\"bo_v_img\">\n";

            for ($i=0; $i<=count($view['file']); $i++) {
                if ($view['file'][$i]['view']) {
                    //echo $view['file'][$i]['view'];
                    echo get_view_thumbnail($view['file'][$i]['view']);
                }
            }

            echo "</div>\n";
        }
        ?>

위의 일반 첨부파일 불러오는걸 적용하면 되는데요.
"unitegallery" 요기 뷰페이지  스킨을 사용 하면 에디터 이미지는 잘되구요..
첨부파일 소스가 어떻게 되어야 되는지요? 초보다보니 갈길이 머네요.

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

회원로그인

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