TAG Clouds

New Postings

  • 마음이 있지 않으면 보아도 보이지 않고, 들어도 들리지 않고, 먹어도 그 맛을 모른다.
    - 대학


조회 수 9634 추천 수 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
번호 분류 제목 글쓴이 날짜 조회 수 추천 수
110 영어 영어 접두사 6가지 쉽게 풀어보기 Dreamy 2015.08.18 1872 0
109 영어 접두사 trans- 관련 단어 Dreamy 2015.08.26 3210 0
108 인터넷 인터넷에서 가져온 랜덤한 이미지를 넣고 싶을 땐 Dreamy 2015.09.25 1859 0
107 칵테일 건배사 모음 secret Dreamy 2015.10.06 0 0
106 칵테일 2014 대한민국 인기 칵테일 Top10 Dreamy 2015.10.07 2762 0
105 칵테일 홈메이드 칵테일 노트 secret Dreamy 2015.10.07 0 0
104 칵테일 홈메이드 칵테일 레시피 secret Dreamy 2015.10.07 0 0
103 성당 미사 통상문 (라틴어/한국어) Dreamy 2015.10.15 2022 0
102 성당 라틴어 미사통상문 Dreamy 2015.10.15 2171 0
101 취미 악기의 이름과 약어(略語) Dreamy 2015.10.16 1969 0
100 취미 옥상달빛 - 수고했어 오늘도 Dreamy 2016.01.17 1898 0
99 일반 BLT 샌드위치 만들기 Dreamy 2016.02.11 1974 0
98 취미 미술 보기 secret Dreamy 2016.02.12 0 0
97 취미 카라얀과 베르디 / 레퀴엠 Dreamy 2016.05.10 1998 0
96 일반 '사용중'인 COM ports를 삭제하는 방법 Dreamy 2016.05.23 2161 0
Board Pagination ‹ Prev 1 ... 4 5 6 7 8 9 10 11 12 13 14 15 ... 17 Next ›
/ 17

나눔글꼴 설치 안내


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

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

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5