change menu

This commit is contained in:
2022-10-14 09:41:42 +07:00
parent 982db2b6c8
commit d6d7dc3719
6 changed files with 63 additions and 63 deletions

View File

@@ -117,4 +117,39 @@ class CaptureLogsController extends Controller {
throw new NotFoundHttpException(Yii::t("app", "KHONG_TIM_THAY_THONG_TIN"));
}
public function actionFaceComparison() {
if (Yii::$app->request->post()) {
$post = Yii::$app->request->post();
Yii::$app->response->format = "json";
$results = json_decode(file_get_contents("http://192.168.1.43:2305/compare", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
'method' => "POST",
'content' => json_encode([
"type" => "base64",
"img0" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face1'])),
"img1" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face2']))
])
]
])), true);
return [
"type1" => number_format($results['type1']['percent'] * 100, 2),
"type2" => number_format($results['type2']['percent'] * 100, 2)
];
} else {
$this->view->title = Yii::t("app", "SO_SANH_MAT");
return $this->render('face-comparison', [
]);
}
}
public function actionUploadFace() {
if (Yii::$app->request->post()) {
$post = Yii::$app->request->post();
$model = new \app\models\UploadForm();
$url = $model->UploadGlobal("image" . $post['imageIndex'], ["PNG", "JPG", "JPEG", "GIF"], "comparison");
return $url;
}
}
}