diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e088ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.jpg +*.JPG +*.Jpg +*.pdf +*.PDF +*.Pdf diff --git a/index.php b/index.php index 514e5f3..f2abf6d 100644 --- a/index.php +++ b/index.php @@ -8,7 +8,18 @@
array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to @@ -37,8 +47,8 @@ if (isset($_POST["scan"])) { $cwd = '/tmp'; $env = array(); - $process = proc_open("/usr/bin/scanadf -d epkowa:net:pr01.lzu01.point808.com --output-file ". - "/var/www/scanout/$fileName-%04d --quick-format Letter". + $process = proc_open("/usr/bin/scanimage -d $device --output-file ". + "$scans_dir . $fileName-%04d --quick-format Letter". " --mode $_POST[mode] --resolution $_POST[quality] --source Automatic Document Feeder", $descriptorspec, $pipes, $cwd, $env); if (is_resource($process)) { @@ -46,7 +56,7 @@ if (isset($_POST["scan"])) { $output = stream_get_contents($pipes[1]); } - $dirList = scandir("/var/www/scanout"); + $dirList = scandir($scans_dir); $inputFiles = array(); $firstFile = ""; foreach ($dirList as $file) { @@ -61,10 +71,10 @@ if (isset($_POST["scan"])) { { $path=""; foreach ($inputFiles as $file) { - $path .= "pnm:/var/www/scanout/$file "; + $path .= "pnm:" . $scans_dir . $file; } - $output = `/usr/bin/convert pnm:/var/www/scanout/$firstFile -resize '>300x' -strip /var/www/scanout/$firstFile.jpg`; - $output .= `/usr/bin/convert -page a4 $path /var/www/scanout/$fileName.pdf`; + $output = `/usr/bin/convert pnm:$scans_dir$firstFile -resize '>300x' -strip $scans_dir$firstFile.jpg`; + $output .= `/usr/bin/convert -page a4 $path $scans_dir$fileName.pdf`; echo "Scan Successful!"; } else { echo "Scan Failed! No pages were scanned. Is there a document in the scanner?"; @@ -80,86 +90,105 @@ if (isset($_POST["scan"])) {Use the drop-downs below to set preferences. Load documents in the feeder and press "Scan". When the job completes, you will be able to pick your file from the selection at the bottom of the page.
-