고수님들 에디터 이미지 삭제 만들어보았는데요... 더 쉬운 방법이 있나요???
본문
스킨/delete.skin.php
게시물 삭제시 에이터 내용을 읽어와서 정규식으로 이미지 추출후
현재 나의 에디터 경로와 같다면 삭제
// editor image delete
preg_match_all("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $write['wr_content'], $Link);
$Link_Count = count($Link[1]);
for($Links=0; $Links < $Link_Count; $Links++){
$LinkName = $Link[1][$Links];
if(preg_match('/data\/editor/', $LinkName)){
$LinkName = str_replace(G5_URL, G5_PATH, $LinkName);
if(file_exists($LinkName) == true){
@unlink($LinkName);
}
}
}
더쉽거나 아니면 이렇게 해서 문재될점이 어떤것들이 있을까요??
답변 1
preg_match_all('@/data/editor[^"]+@', $write['wr_content'], $m);
foreach($m[0] as $val) if(file_exists(G5_PATH.$val)) @unlink(G5_PATH.$val);
답변을 작성하시기 전에 로그인 해주세요.