From 2619e8749adac40a158966800453e0fd1f397d81 Mon Sep 17 00:00:00 2001 From: chicpro Date: Mon, 25 Feb 2013 10:48:15 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=90=EB=94=94=ED=84=B0=EB=A1=9C=20?= =?UTF-8?q?=EC=B2=A8=EB=B6=80=EB=90=9C=20=ED=8C=8C=EC=9D=BC=EC=9D=98=20?= =?UTF-8?q?=EC=8D=B8=EB=84=A4=EC=9D=BC=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20?= =?UTF-8?q?=EC=9B=90=EB=B3=B8=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/view_image.php | 14 ++++++++++++-- lib/thumbnail.lib.php | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) 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); } }