changed logic in api in ocr
This commit is contained in:
@@ -56,7 +56,11 @@ use thiagoalessio\TesseractOCR\TesseractOCR;
|
||||
$lines = preg_split('/\r\n|\r|\n/', $text);
|
||||
$serials = array_filter(array_map('trim', $lines), fn($line) => preg_match('/^[A-Z0-9]+$/', $line));
|
||||
|
||||
return response()->json(['success' => true, 'text' => $serials]);
|
||||
//return response()->json(['success' => true, 'text' => $serials]);
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'text' => array_values($serials), // send as array
|
||||
]);
|
||||
}
|
||||
//catch (\Exception $e) {
|
||||
// return response()->json(['success' => false, 'error' => $e->getMessage()]);
|
||||
|
||||
Reference in New Issue
Block a user