에디터 첨부 이미지 대신 첨부파일로.
본문
** 현재 아래의 소스는 슬라이딩 이미지에 관련된 소스입니다. //
** 원본 소스 : 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
}
}
?>