예제 #1
0
            $pics = date("YmdHis") . $rand . "thumbnail" . $type;
            if (!file_exists("public_html/img/projectImg/" . $edit_id)) {
                mkdir("public_html/img/projectImg/" . $edit_id, 0777, true);
            }
            $pic_path = "public_html/img/projectImg/" . $edit_id . "/" . $pics;
            move_uploaded_file($_FILES[$thumbnailId]['tmp_name'], $pic_path);
            if ($photoMgr->getSpecificPhotoURL($edit_id, "thumbnail" . strval($x)) !== '') {
                $photoMgr->updateSpecificPhoto($edit_id, "thumbnail" . strval($x), $pic_path);
            } else {
                //            $photoList = $photoMgr->getPhotosByProject($edit_id);
                //            $index = intval(sizeof($photoList)/2)+1;
                $photoMgr->AddPhoto($edit_id, "thumbnail" . strval($index), $pic_path);
            }
        }
    }
    /****************************************************/
    $msg = "Project " . $edit_id . " updated successfully!";
    header("Location: admin.php?message=" . $msg);
} elseif ($operation === "populate") {
    $projectid = addslashes(filter_input(INPUT_POST, 'projectid'));
    $project = $projectMgr->getProject($projectid);
    echo json_encode($project);
} elseif ($operation === 'deletePhoto') {
    $editid = addslashes(filter_input(INPUT_POST, 'editid'));
    $photo_no = addslashes(filter_input(INPUT_POST, 'photo_no'));
    $photoMgr->deleteSpecificPhoto($editid, 'hd' . $photo_no);
    $photoMgr->deleteSpecificPhoto($editid, 'thumbnail' . $photo_no);
    $return = [];
    $return['status'] = 'success';
    echo json_encode($return);
}