From ce863a71f86dfd046abd526061909bab655c2c74 Mon Sep 17 00:00:00 2001 From: zero Date: Fri, 22 Jun 2007 03:43:41 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@1733 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/board/skins/xe_list/list.html | 3 ++ modules/board/skins/xe_list/skin.xml | 6 ++++ modules/document/document.item.php | 44 +++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/modules/board/skins/xe_list/list.html b/modules/board/skins/xe_list/list.html index 47594719a..5f6aea5f4 100644 --- a/modules/board/skins/xe_list/list.html +++ b/modules/board/skins/xe_list/list.html @@ -76,6 +76,9 @@ + + + document_srl])-->checked="true" /> diff --git a/modules/board/skins/xe_list/skin.xml b/modules/board/skins/xe_list/skin.xml index 13e98d187..6f32da312 100644 --- a/modules/board/skins/xe_list/skin.xml +++ b/modules/board/skins/xe_list/skin.xml @@ -31,5 +31,11 @@ 제목 글자수 제목 글자수를 지정할 수 있습니다. (0또는 비워주시면 자르지 않습니다) + + 썸네일 표시 + 게시물에 이미지가 포함되어 있으면 목록에서 썸네일을 표시합니다. + N + Y + diff --git a/modules/document/document.item.php b/modules/document/document.item.php index eef1212cd..3fd109d18 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -173,6 +173,50 @@ return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); } + function thumbnailExists($width) { + if(!$this->getThumbnail($width)) return false; + return true; + } + + function getThumbnail($width = 80) { + if(!preg_match('!]*?)(\/){0,1}>!is',$this->get('content'),$matches)) return; + + $document_path = sprintf('files/attach/images/%d/%d/',$this->get('module_srl'), $this->get('document_srl')); + if(!is_dir($document_path)) FileHandler::makeDir($document_path); + + $thumbnail_file = sprintf('%sthumbnail_%d.gif', $document_path, $width); + + if(!file_exists($thumbnail_file)) { + + $tmp_file = sprintf('%sthumbnail_%d.tmp.gif', $document_path, $width); + + preg_match('!src=("|\'){0,1}([^"|^\'|^\ ]*)("|\'| ){0,1}!is', $matches[0], $src_matches); + $src = $src_matches[2]; + + // 첨부된 파일일 경우 + if(substr($src,0,7)=='./files') { + copy($src, $tmp_file); + + // 웹에서 링크한 경우 + } else { + FileHandler::getRemoteFile($src, $tmp_file); + } + + // 파일정보를 보아서 가로/세로크기가 64보다 작으면 무시시킴 + list($width, $height, $type, $attrs) = @getimagesize($tmp_file); + + if($width <= 64 && $height <= 64) FileHandler::writeFile($thumbnail_file, '', 'w'); + else FileHandler::createImageFile($tmp_file, $thumbnail_file, 100, 100, 'gif'); + + @unlink($tmp_file); + } + + if(filesize($thumbnail_file)<1) return; + + $thumbnail_url = Context::getRequestUri().$thumbnail_file; + return $thumbnail_url; + } + function hasUploadedFiles() { return $this->get('uploaded_count')? true : false; }