상품삭제시 ckeditor에서 첨부한 이미지 삭제코드 추가
This commit is contained in:
@ -90,6 +90,18 @@ function itemdelete($it_id)
|
|||||||
$it = sql_fetch($sql);
|
$it = sql_fetch($sql);
|
||||||
$s = $it['it_explan'];
|
$s = $it['it_explan'];
|
||||||
|
|
||||||
|
// img 태그의 src 중 data/editor 가 포함된 것만 추출
|
||||||
|
preg_match_all("/<img[^>]*src=[\'\"]?([^>\'\"]+data\/editor[^>\'\"]+)[\'\"]?[^>]*>/", $s, $matchs);
|
||||||
|
|
||||||
|
// 파일의 경로를 얻어 삭제
|
||||||
|
for($i=0; $i<count($matchs[1]); $i++) {
|
||||||
|
$imgurl = parse_url($matchs[1][$i]);
|
||||||
|
$imgfile = $_SERVER['DOCUMENT_ROOT'].$imgurl['path'];
|
||||||
|
if(file_exists($imgfile))
|
||||||
|
@unlink($imgfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
$img_file = Array();
|
$img_file = Array();
|
||||||
while($s) {
|
while($s) {
|
||||||
$pos = strpos($s, "/data/cheditor");
|
$pos = strpos($s, "/data/cheditor");
|
||||||
@ -110,6 +122,7 @@ function itemdelete($it_id)
|
|||||||
if (file_exists($f))
|
if (file_exists($f))
|
||||||
@unlink($f);
|
@unlink($f);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user