diff --git a/bbs/view_image.php b/bbs/view_image.php index f0f8e12db..cf4858449 100644 --- a/bbs/view_image.php +++ b/bbs/view_image.php @@ -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 = ''; } else { alert_close('파일이 존재하지 않습니다.'); diff --git a/lib/thumbnail.lib.php b/lib/thumbnail.lib.php index 258394247..d103f793b 100644 --- a/lib/thumbnail.lib.php +++ b/lib/thumbnail.lib.php @@ -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 = ''.$thumb_tag.''; + } + $contents = str_replace($img_tag, $thumb_tag, $contents); } }