I have been trying to work this out for a couple days now and can’t crack it.
I’m trying to use php to echo the result of tesseract.
After everything I’ve researched and tried, I feel like the below code should work.
<?php echo '<pre>'; echo exec('/usr/local/bin/tesseract /home/username/www/ocr/images/hello.png result'); echo '</pre>'; ?>
The command runs fine via SSH and if I change the above to suit ifconfig
it works fine.
Any ideas to get this working?
Advertisement
Answer
I ended up getting this working by just breaking everything down.
file_put_contents("$tmpFile",file_get_contents($img)); $cmd = "/usr/local/bin/tesseract $tmpFile stdout"; exec($cmd, $msg); $arraymsg = $msg; $msg = implode(' ', $msg); echo $msg;