I am attempting to install the OCR software Tesseract onto my WAMP server so that I can then automate the OCR process for some images. When I search for how to install software onto a WAMP server, all I get back is how to install a WAMP server so that route turned up no answers. I have successfully installed Tesseract on my computer and know that the files I am using work properly, my issue is that I am unable to run Tesseract from a PHP script. I used the Windows installer that is provided and installed it to my www directory in WAMP. I then attempted to use the PHP exec()
to perform some OCR and got no output. This is my simple script:
<?php
$path = getenv('PATH');
putenv("PATH=$path:/usr/local/bin");
$src = 'a.jpg';
$srcImg = imagecreatefromjpeg($src);
$img = imagecreatetruecolor($newClanWidth, $newHeight);
imagecopyresampled($img, $srcImg, 0, 0, $positions["aPlayer"], $positions[0], $newClanWidth, $newHeight, $clanWidth, $height);
imagejpeg($img, 'temp.jpg', 100);
echo '<pre>';
exec('tesseract temp.jpg out');
//echo file_get_contents('out.txt');
echo '</pre>';
imagedestroy($img);
?>
The image is being saved correctly. I can change the positions in the imagecopyresampled()
and the image is changed accordingly. I suspect my problem is with the installation since everywhere I look everyone says to use exec()
just like I would from a command line. I have also tried specifying the command like Tesseract-OCR/tesseract.exe temp.jpg out
. The Tesseract-OCR folder is in the same directory as my PHP script. I admit to being new to this, so please bear with me if there is something simple I've overlooked. Thanks in advance.