Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $filename = "image_".rand().".png";
- $scan_command = 'scanimage ';
- if(array_key_exists('preview',$_POST) && $_POST['preview']){
- $filename = 'preview.png';
- $scan_command .= '--preview=yes --preview-mode Gray --resolution 50';
- }
- if(array_key_exists('mode',$_POST)){
- $scan_command .= ' --mode ' . $_POST['mode'];
- }
- if(array_key_exists('resolution',$_POST)){
- $scan_command .= ' --resolution ' . $_POST['resolution'];
- }
- if(array_key_exists('l',$_POST)){
- $scan_command .= ' -l ' . $_POST['l'];
- }
- if(array_key_exists('t',$_POST)){
- $scan_command .= ' -t ' . $_POST['t'];
- }
- if(array_key_exists('x',$_POST)){
- $scan_command .= ' -x ' . $_POST['x'];
- }
- if(array_key_exists('y',$_POST)){
- $scan_command .= ' -y ' . $_POST['y'];
- }
- system("$scan_command | convert ppm:- images/$filename");
- header("Content-Type: text/javascript");
- echo '{"success":true,"file_name":"'.$filename.'"}';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement