채택완료

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

2021-11-03 (수) 14:35:50 1,711

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

** 원본 소스 : 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개 / 댓글 4개

채택된 답변
+20 포인트

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

Copy
<?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

            }

        }

         ?>

답변에 대한 댓글 4개

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

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" 요기 뷰페이지 스킨을 사용 하면 에디터 이미지는 잘되구요..
첨부파일 소스가 어떻게 되어야 되는지요? 초보다보니 갈길이 머네요.
제가 보여드린 소스를 참조해서
하나씩 수정하면서 적용해야 합니다.
네. 답변 감사합니다. 제가 초보라 잘 모릅니다.

구체적으로 어느부분을 어느곳을 하나씩 수정하란 말씀인지 이해가 안가네요. ㅠ

조금이라도 집어 주셨으면 하는 바람입니다. ㅠㅠ

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