From b7e9062c9ee60dec2e2d453b174e6f198cec4185 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 23 Oct 2025 15:06:57 +0530 Subject: [PATCH] Added psm in ocr --- routes/web.php | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/routes/web.php b/routes/web.php index dae2c06..2766a27 100644 --- a/routes/web.php +++ b/routes/web.php @@ -31,33 +31,6 @@ use thiagoalessio\TesseractOCR\TesseractOCR; ]); }); - Route::get('/debug-env', function () { - return response()->json([ - 'php_sapi' => php_sapi_name(), - 'user' => trim(shell_exec('whoami')), - 'which_tesseract' => trim(shell_exec('which tesseract')), - 'path' => getenv('PATH'), - 'php_binary' => PHP_BINARY, - 'disable_functions' => ini_get('disable_functions'), - ]); -}); - -Route::get('/debug-tesseract', function () { - $output = []; - $status = null; - - exec('/usr/bin/tesseract --version 2>&1', $output, $status); - - return response()->json([ - 'status' => $status, - 'output' => $output, - 'whoami' => trim(shell_exec('whoami')), - 'php_sapi' => php_sapi_name(), - 'path' => getenv('PATH'), - 'disable_functions' => ini_get('disable_functions'), - ]); -}); - Route::post('/verify-ocr', function (Request $request) { if (!$request->has('path')) { @@ -74,9 +47,8 @@ Route::get('/debug-tesseract', function () { // $text = (new TesseractOCR($filePath))->lang('eng')->run(); $text = (new TesseractOCR($filePath)) ->executable('/usr/bin/tesseract') - //->executable('/var/www/tesseract') - //->env('PATH', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin') ->lang('eng') + ->psm(6) ->run(); return response()->json(['success' => true, 'text' => $text]);