diff --git a/index.php b/index.php new file mode 100644 index 0000000..4a8b0af --- /dev/null +++ b/index.php @@ -0,0 +1,102 @@ + + +Scanimage Web GUI + + + 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 + 2 => array("pipe", "w") // stderr is a file to write to + ); + $env=array(); + $process = proc_open("/usr/bin/sane-find-scanner", $findScanner, $pipes, '/tmp', $env); + if (is_resource($process)) { + $data = stream_get_contents($pipes[2]); + $data .= stream_get_contents($pipes[1]); + } + proc_close($process); + $match = preg_match('/libusb:\d+:\d+/', $data, $matches); + if ($match&&count($matches)) { + $address=$matches[0]; + } + $fileName = "Scan_".date("Y-m-d_H.i.s"); + $descriptorspec = array( + 0 => 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 + 2 => array("pipe", "w") // stderr is a file to write to + ); + $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". + " --mode $_POST[mode] --resolution $_POST[quality] --source Automatic Document Feeder", $descriptorspec, $pipes, $cwd, $env); + + if (is_resource($process)) { + $errors = stream_get_contents($pipes[2]); + $output = stream_get_contents($pipes[1]); + } + + $dirList = scandir("/var/www/scanout"); + $inputFiles = array(); + $firstFile = ""; + foreach ($dirList as $file) { + if (stristr($file, $fileName)) { + //this is one of our input files + if ($firstFile=="") $firstFile = $file; + array_push($inputFiles, $file); + } + } + + if (count($inputFiles)) + { + $path=""; + foreach ($inputFiles as $file) { + $path .= "pnm:/var/www/scanout/$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`; + echo "Scan Successful!"; + } else { + echo "Scan Failed! No pages were scanned. Is there a document in the scanner?"; + } + ob_flush(); + echo ""; +} +?> +

Scan A Document

+

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.

+
+Color or Black & White? +
+Regular, high, low quality? +
+ + + +
+ +

Previous Scans

+

(Newest scan is on top!)

+ ".basename($phpfile)."
"; + } + ?> + + +