mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 08:49:56 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1733 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
abb1c1a356
commit
ce863a71f8
3 changed files with 53 additions and 0 deletions
|
|
@ -76,6 +76,9 @@
|
|||
<!--@end-->
|
||||
|
||||
<td class="title">
|
||||
<!--@if($module_info->display_thumnail=='Y' && $document->thumbnailExists(100))-->
|
||||
<a href="#" class="thumbnailMedium"><img src="{$document->getThumbnail(100)}" border="0" alt="" /></a>
|
||||
<!--@end-->
|
||||
<!--@if($grant->is_admin)-->
|
||||
<input type="checkbox" value="{$document->document_srl}" onclick="doAddCart('{$mid}',this)" <!--@if($check_list[$document->document_srl])-->checked="true"<!--@end--> />
|
||||
<!--@end-->
|
||||
|
|
|
|||
|
|
@ -31,5 +31,11 @@
|
|||
<title xml:lang="ko">제목 글자수</title>
|
||||
<description lang="ko">제목 글자수를 지정할 수 있습니다. (0또는 비워주시면 자르지 않습니다)</description>
|
||||
</var>
|
||||
<var name="display_thumnail" type="select">
|
||||
<title xml:lang="ko">썸네일 표시</title>
|
||||
<description lang="ko">게시물에 이미지가 포함되어 있으면 목록에서 썸네일을 표시합니다.</description>
|
||||
<default>N</default>
|
||||
<default>Y</default>
|
||||
</var>
|
||||
</extra_vars>
|
||||
</skin>
|
||||
|
|
|
|||
|
|
@ -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('!<img([^>]*?)(\/){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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue