2

I am encountering this error message

Error! The command "tesseract" was not found.

However, tesseract and tesseract php wrapper is already installed.

When I run below,

echo (new TesseractOCR())->version();

it shows the version. When I run this,

$ocr = new TesseractOCR(asset('uploads/img.jpg'));
$ocr->run();

the error shows.

Please help.

Thank you!

my Code

public function creditCardOrderProcessImage() 
{
    $image = Input::file('image');
    $name = time().'-'.$image->getClientOriginalName();
    $file = $image->move('uploads/', $name);

    echo '<img src ='.asset('uploads/'.$name).' />';

    $ocr = new TesseractOCR(asset('uploads/'.$name));
    $ocr->run();

}

1 Answers1

0

Youre just trying to define the image path? See

 $ocr = new TesseractOCR();
 $ocr->image('uploads/img.jpg');
 $ocr->run();
dan webb
  • 626
  • 1
  • 5
  • 9
  • So how should it be done? what I am doing is an input type="file" when onchange runs an ajax which process the OCR. I tried not saving the image and getting it through $_files. but still error occurs. –  Dec 11 '18 at 03:34
  • try $ocr = new TesseractOCR(storage_path('uploads/img.jpg')); – dan webb Dec 11 '18 at 03:53
  • Already tried it and still doesn't work. It still says tesseract is not installed, Additional info in error message : he current $PATH is C:\ProgramData\ComposerSetup\bin;C:\php;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\nodejs\;C:\Program Files (x86)\Tesseract-OCR;C:\ProgramData\chocolatey\bin' (length=358) –  Dec 11 '18 at 03:57
  • I am not sure about your environment. Does this help? https://stackoverflow.com/questions/50655738/tesseract-not-found-error – dan webb Dec 11 '18 at 04:04
  • I am currently using laravel 4.2 w/php 5.6 –  Dec 11 '18 at 04:06
  • Youre on windows it looks like. You might be missing "\tesseract.exe" in your path after "C:\Program Files (x86)\Tesseract-OCR;" – dan webb Dec 11 '18 at 04:12
  • Thank you for helping me, I added this executable('C:\Program Files (x86)\Tesseract-OCR\tesseract.exe') on the code and it worked! –  Dec 11 '18 at 04:14