삭품삭제시 에디터 이미지 삭제코드 수정

This commit is contained in:
chicpro
2013-03-22 13:40:08 +09:00
parent 4859612f52
commit c4685adf35

View File

@ -82,29 +82,22 @@ function itemdelete($it_id)
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// HTML 내용에서 에디터에 올라간 이미지의 경로를 얻어 삭제함 // HTML 내용에서 에디터에 올라간 이미지의 경로를 얻어 삭제함
//------------------------------------------------------------------------ //------------------------------------------------------------------------
$sql = " select * from {$g4['yc4_item_table']} where it_id = '$it_id' "; $sql = " select it_explan from {$g4['yc4_item_table']} where it_id = '$it_id' ";
$it = sql_fetch($sql); $it = sql_fetch($sql);
$s = $it['it_explan'];
$img_file = Array(); $imgs = get_editor_image($it['it_explan']);
while($s) {
$pos = strpos($s, "/data/cheditor");
$s = substr($s, $pos, strlen($s));
$pos = strpos($s, '"');
// 결과값 for($i=0;$i<count($imgs[1]);$i++) {
$file_path = substr($s, 0, $pos); $p = parse_url($imgs[1][$i]);
if (!$file_path) break; if(strpos($p['path'], "/data/") != 0)
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
else
$data_path = $p['path'];
$img_file[] = $file_path; $destfile = G4_PATH.$data_path;
$s = substr($s, $pos, strlen($s)); if(is_file($destfile))
} @unlink($destfile);
for($i=0;$i<count($img_file);$i++) {
$f = $g4[path].$img_file[$i];
if (file_exists($f))
@unlink($f);
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@ -183,7 +176,7 @@ if ($createimage && $_FILES['it_limg1']['name'])
upload_file($_FILES['it_limg1']['tmp_name'], $it_id."_l1", "$g4[path]/data/item"); upload_file($_FILES['it_limg1']['tmp_name'], $it_id."_l1", "$g4[path]/data/item");
$image = G4_DATA_PATH."/item/$it_id"."_l1"; $image = G4_DATA_PATH."/item/$it_id"."_l1";
$size = getimagesize($image); $size = @getimagesize($image);
$src = @imagecreatefromjpeg($image); $src = @imagecreatefromjpeg($image);
if (!$src) if (!$src)