mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
썸네일 생성시 2번째 첨부파일의 썸네일이 생성되는 문제와 첨부파일없이 내용에 이미지 링크되었을때 썸네일이 생성되지 않는 오류 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4364 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
5a135acfa6
commit
cd8512a846
2 changed files with 17 additions and 11 deletions
|
|
@ -333,21 +333,26 @@
|
|||
// 파일을 쓰고 끝냄
|
||||
switch($target_type) {
|
||||
case 'gif' :
|
||||
@imagegif($thumb, $target_file, 100);
|
||||
$output = @imagegif($thumb, $target_file);
|
||||
break;
|
||||
case 'jpeg' :
|
||||
case 'jpg' :
|
||||
@imagejpeg($thumb, $target_file, 100);
|
||||
$output = @imagejpeg($thumb, $target_file, 100);
|
||||
break;
|
||||
case 'png' :
|
||||
@imagepng($thumb, $target_file, 9);
|
||||
$output = @imagepng($thumb, $target_file, 9);
|
||||
break;
|
||||
case 'wbmp' :
|
||||
case 'bmp' :
|
||||
@imagewbmp($thumb, $target_file, 100);
|
||||
$output = @imagewbmp($thumb, $target_file, 100);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!$output) return false;
|
||||
|
||||
@chmod($target_file, 0644);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@
|
|||
if(!$height) $height = $width;
|
||||
|
||||
// 첨부파일이 없거나 내용중 이미지가 없으면 return false;
|
||||
if(!$this->hasUploadedFiles() && !preg_match("!http:\/\/([^ ^\"^']*?)\.(jpg|png|gif|jpeg|bmp)!is", $this->get('content'))) return;
|
||||
if(!$this->hasUploadedFiles() && !preg_match("!<img!is", $this->get('content'))) return;
|
||||
|
||||
// 문서 모듈의 기본 설정에서 Thumbnail의 생성 방법을 구함
|
||||
if(!in_array($thumbnail_type, array('crop','ratio'))) {
|
||||
|
|
@ -475,8 +475,7 @@
|
|||
$filename = $file->uploaded_filename;
|
||||
if(!file_exists($filename)) continue;
|
||||
|
||||
FileHandler::createImageFile($filename, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
|
||||
if(file_exists($thumbnail_file) && filesize($thumbnail_file)>0) return Context::getRequestUri().$thumbnail_file;
|
||||
if(FileHandler::createImageFile($filename, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type)) return Context::getRequestUri().$thumbnail_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -484,16 +483,18 @@
|
|||
// 첨부된 파일이 없으면 내용중 이미지 파일을 구함
|
||||
$content = $this->get('content');
|
||||
$target_src = null;
|
||||
preg_match_all("!http:\/\/([^ ^\"^']*?)\.(jpg|png|gif|jpeg|bmp)!is", $content, $matches, PREG_SET_ORDER);
|
||||
preg_match_all("!src=(\"|')([^\"' ]*?)(\"|')!is", $content, $matches, PREG_SET_ORDER);
|
||||
for($i=0;$i<count($matches);$i++) {
|
||||
$target_src = $matches[$i][0];
|
||||
$target_src = $matches[$i][2];
|
||||
if(preg_match('/\/(common|modules|widgets|addons|layouts)\//i', $target_src)) continue;
|
||||
else {
|
||||
if(!preg_match('/^(http|https):\/\/',$target_src)) $target_src = Context::getRequestUri().$target_src;
|
||||
$tmp_file = sprintf('./files/cache/tmp/%d', md5(rand(111111,999999).$this->document_srl));
|
||||
FileHandler::getRemoteFile($target_src, $tmp_file);
|
||||
if(file_exists($tmp_file)) FileHandler::createImageFile($tmp_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
|
||||
if(!file_exists($tmp_file)) continue;
|
||||
$output = FileHandler::createImageFile($tmp_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
|
||||
FileHandler::removeFile($tmp_file);
|
||||
if(file_exists($thumbnail_file) && filesize($thumbnail_file)>0) return Context::getRequestUri().$thumbnail_file;
|
||||
if($output) return Context::getRequestUri().$thumbnail_file;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue