TAG Clouds

New Postings

  • 인간의 자유는 '원하는 것을 할 수 있는데' 있는 것이 아니라, '원하지 않는 것을 하지 않아도 되는 데' 있다.
    - 루소


조회 수 9762 추천 수 0 댓글 0
소스 파일을 수정하는 것이므로 반드시 백업을 하시길 권합니다.

게시판의 썸네일 생성 함수를 응용해 원본 이미지를 구하는 함수를 만들어 
이를 게시판 썸네일에 링크 시키는 방식입니다.

1. (수정) modules/document/document.item.php 에서  } ?>  위에 다음 함수를 추가합니다.
      ※ (09.10.24 수정) 함수에 오류가 있어 수정했습니다.  

function getThumbSourceFile() {
            // 썸네일 원본 파일 출력함수
            if($this->get('uploaded_count')) {
                $oFileModel = &getModel('file');
                $s_file_list = $oFileModel->getFiles($this->document_srl);
                $s_source_file = $s_file_list[0]->uploaded_filename;
            }

            // 첨부된 파일이 없으면 내용중 이미지 파일을 구함
            if(!$s_source_file) {
                $content = $this->get('content');
                $s_target_src = null;
preg_match("/src=(\"|')([^\"' ]*?)(\"|')/is", $content, $s_matches);
              $s_target_src = trim($s_matches[2]);
                $s_source_file = $s_target_src;
            }
                      
            return $s_source_file;
        }
   }
?>

2. 게시판 스킨의 썸네일 링크 부분을 수정합니다. xe_official 게시판 스킨의 웹진 스타일을 예로 들면
modules/board/skins/xe_official/_style.webzine.html 에서 아래 부분을 찾아

<a href="{getUrl("document_srl',$document->document_srl,'listStyle',$listStyle, 'cpage','')}" class="thumb"><img src="{$document->getThumbnail($module_info->thumbnail_width, $module_info->thumbnail_height, $module_info->thumbnail_type)}" alt="" /></a>

다음과 같이 수정합니다.

<a href="{$document->getThumbSourceFile()}" class="thumb" target='_blank'><img src="{$document->getThumbnail($module_info->thumbnail_width, $module_info->thumbnail_height, $module_info->thumbnail_type)}" alt="" /></a> 

3. 만약 June Oh님의 HighSlide JS을 사용하고 있다면 아래와 같이 수정합니다.

<span class="thumb"><a href="{$document->getThumbSourceFile()}" class="highslide" onclick="return hs.expand(this)"><img src="{$document->getThumbnail($module_info->thumbnail_width, $module_info->thumbnail_height, $module_info->thumbnail_type)}" alt="" /></a></span>

4. 갤러리 스타일 역시 썸네일 부분을 찾아 위와 같은 방식으로 수정하면 됩니다. 
xe_official 게시판 스킨을 예로 들면 위의 2번 디렉토리에서 _style.gallery.html 파일을 아래와 같은 식으로 수정합니다.

<a href="{$document->getThumbSourceFile()}" target="_blank"><img src="{$document->getThumbnail($module_info->thumbnail_width, $module_info->thumbnail_height, $module_info->thumbnail_type)}" alt=""/><!--@if($module_info->use_category == "Y" && $document->get('category_srl'))--><strong class="category">{$category_list[$document->get('category_srl')]->title}</strong><!--@end--></a>

역시 June Oh님의 HighSlide JS을 적용하려면 아래와 같이 수정합니다.

<a href="{$document->getThumbSourceFile()}" class="highslide" onclick="return hs.expand(this)"><img src="{$document->getThumbnail($module_info->thumbnail_width, $module_info->thumbnail_height, $module_info->thumbnail_type)}" alt=""/><!--@if($module_info->use_category == "Y" && $document->get('category_srl'))--><strong class="category">{$category_list[$document->get('category_srl')]->title}</strong><!--@end--></a>

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수 추천 수
24 일반 Alice's Adventures in Wonderland, by Lewis Carroll secret Dreamy 2014.04.21 1 0
23 일반 윈도우 창 미리보기 해제 Dreamy 2014.07.11 2112 0
22 일반 교통사고 상식 Dreamy 2014.09.11 2146 0
21 일반 해리 터틀도브 - 가지 않은 길(The road not taken) Dreamy 2014.09.19 2306 0
20 일반 마트 쇼핑 목록 secret Dreamy 2014.12.20 0 0
19 일반 역대 가요톱10 1위곡 목록 Dreamy 2015.01.04 2331 0
18 일반 유튜브 동영상을 글 속에서 배경음으로 사용하기 Dreamy 2015.06.29 1974 0
17 일반 BLT 샌드위치 만들기 Dreamy 2016.02.11 2111 0
16 일반 '사용중'인 COM ports를 삭제하는 방법 Dreamy 2016.05.23 2256 0
15 일반 테오 얀센 메커니즘 Teo Jansen mechanisom file Dreamy 2016.06.08 2057 0
14 일반 텔레그램 스티커 모음 Dreamy 2016.07.07 2144 0
13 일반 할머니가 들려주시던 옛날 이야기 모음 1 Dreamy 2016.11.07 2725 0
12 일반 Cool Life Hacks file Dreamy 2016.12.19 2555 0
11 일반 학교 폭력 해결 방법 Dreamy 2018.07.06 2493 0
10 일반 각종 양념 레시피 file Dreamy 2019.01.08 1745 0
Board Pagination ‹ Prev 1 2 3 4 5 Next ›
/ 5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5