From cda57477502df187d4ad87cdd28198ade74a8776 Mon Sep 17 00:00:00 2001 From: chicpro Date: Fri, 22 Feb 2013 10:32:27 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=B2=A8?= =?UTF-8?q?=EB=B6=80=ED=8C=8C=EC=9D=BC=20=EC=8D=B8=EB=84=A4=EC=9D=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20delete=5Fboard=5Fthumbnail=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common.lib.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/common.lib.php b/lib/common.lib.php index 5704abb15..f5b33db44 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1721,9 +1721,24 @@ function delete_cache_latest($bo_table) } } +// 게시판 첨부파일 썸네일 삭제 +function delete_board_thumbnail($bo_table, $file) +{ + if(!$bo_table || !$file) + return; + + $fn = preg_replace("/\.[^\.]+$/i", "", basename($file)); + foreach(glob(G4_DATA_PATH.'/file/'.$bo_table.'/thumb-'.$fn.'*') as $file) { + unlink($file); + } +} + // 에디터 이미지 얻기 function get_editor_image($contents) { + if(!$contents) + return false; + // $contents 중 img 태그 추출 $pattern = "/]*src=[\'\"]?([^>\'\"]+".str_replace(".", "\.", $_SERVER['HTTP_HOST'])."[^>\'\"]+)[\'\"]?[^>]*>/"; preg_match_all($pattern, $contents, $matchs); @@ -1734,9 +1749,15 @@ function get_editor_image($contents) // 에디터 썸네일 삭제 function delete_editor_thumbnail($contents) { + if(!$contents) + return; + // $contents 중 img 태그 추출 $matchs = get_editor_image($contents); + if(!$matchs) + return; + for($i=0; $i