Merge branch 'master' of github.com:gnuboard/g4s

This commit is contained in:
whitedot
2013-02-25 11:03:22 +09:00
2 changed files with 18 additions and 3 deletions

View File

@ -7,7 +7,13 @@ include_once(G4_PATH.'/head.sub.php');
$filename = $_GET['fn'];
$bo_table = $_GET['bo_table'];
$filepath = G4_DATA_PATH.'/file/'.$bo_table.'/'.$filename;
if(strpos($filename, 'data/editor')) {
$editor_file = strstr($filename, 'editor');
$filepath = G4_DATA_PATH.'/'.$editor_file;
} else {
$editor_file = '';
$filepath = G4_DATA_PATH.'/file/'.$bo_table.'/'.$filename;
}
if(is_file($filepath)) {
$size = @getimagesize($filepath);
@ -17,7 +23,11 @@ if(is_file($filepath)) {
$width = $size[0];
$height = $size[1];
$fileurl = G4_DATA_URL.'/file/'.$bo_table.'/'.$filename;
if($editor_file)
$fileurl = G4_DATA_URL.'/'.$editor_file;
else
$fileurl = G4_DATA_URL.'/file/'.$bo_table.'/'.$filename;
$img = '<img src="'.$fileurl.'" alt="" width="'.$width.'" height="'.$height.'" class="draggable" style="position:relative;top:0;left:0;cursor:move;">';
} else {
alert_close('파일이 존재하지 않습니다.');

View File

@ -11,7 +11,7 @@ function it_img_thumb($filename, $filepath, $thumb_width, $thumb_height, $is_cre
// 게시글보기 썸네일 생성
function get_view_thumbnail($contents)
{
global $board;
global $board, $config;
$dvc_width = intval($_COOKIE['device_width']);
if(G4_IS_MOBILE && $dvc_width) {
@ -81,6 +81,11 @@ function get_view_thumbnail($contents)
$thumb_tag = str_replace($mh[0], str_replace($mh[1], $thumb_height, $mh[0]), $thumb_tag);
}
// $img_tag에 editor 경로가 있으면 원본보기 링크 추가
if(strpos($matchs[1][$i], 'data/editor') && preg_match("/\.({$config['cf_image_extension']})$/i", $filename)) {
$thumb_tag = '<a href="'.G4_BBS_URL.'/view_image.php?fn='.urlencode($imgurl['path']).'" target="_blank" class="view_image">'.$thumb_tag.'</a>';
}
$contents = str_replace($img_tag, $thumb_tag, $contents);
}
}