Added OCR and OpenAPI tools

This commit is contained in:
2025-06-09 16:27:14 +02:00
parent 20fca31ced
commit 67197c5c48
12 changed files with 402 additions and 2 deletions

View File

@ -0,0 +1,14 @@
<?php
namespace App\FileTools\OCR;
interface IImageOCR
{
/**
* Perform OCR on the given file.
*
* @param string $filePath The path to the file to be processed.
* @return string The extracted text from the file.
*/
public function performOCR(string $filePath): string;
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\FileTools\OCR;
use thiagoalessio\TesseractOCR\TesseractOCR;
class TesseractImageOCR implements IImageOCR
{
/**
* @inheritDoc
*/
public function performOCR(string $filePath): string {
$tesseract = new TesseractOCR($filePath);
return $tesseract->run();
}
}