/** * Return all faces information in uploaded photo */ function doDetect() { $success = false; $message = ''; $faces = array(); if (fileValidate($filepath, $error)) { $success = true; $faces = face_detect($filepath, 'opencv-2.4.10-haarcascades/' . FACEDETECT_HAARCASCADE_XML); } else { $message = $error; } $jsonData = array('success' => $success, 'message' => $message, 'faces' => $faces); header('Content-type: application/json'); echo json_encode($jsonData); }
<p>Создание товара</p> </div> <div class="row clearfix"> <?php use Respect\Validation\Validator as v; if (empty($_POST)) { include_once $src_path . "templates/_add-shop-item-form.php"; } else { include_once "/product_data-validate.php"; // Data Validation $errors = []; $title = titleValidate($errors, $_POST['title']); $description = descriptionValidate($errors, $_POST['description']); $price = priceValidate($errors, $_POST['price']); if ($_FILES['userfile']['error'] != 4) { $userfile = fileValidate($errors, $_FILES['userfile']['name']); } else { $userfile = false; } if (!v::arr()->notEmpty()->validate($errors)) { $category_id = $_POST['category']; $createProduct = new \App\DB\Products($connection, $title, $description, $price, $category_id); $id = \App\DB\Products::getCurrentId($connection); if ($userfile) { // Set new photo include_once "add-image.php"; } if ($createProduct) { header("Refresh: 0; url=/edit/?id=" . $id); } else { echo "Ошибка. Товар не создан";