Advertisement
Guest User

index.php

a guest
Dec 30th, 2010
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.15 KB | None | 0 0
  1. <?
  2.         $filename = "image_".rand().".png";
  3.         $scan_command = 'scanimage ';
  4.         if(array_key_exists('preview',$_POST) && $_POST['preview']){
  5.                 $filename = 'preview.png';
  6.                 $scan_command .= '--preview=yes --preview-mode Gray --resolution 50';
  7.         }
  8.         if(array_key_exists('mode',$_POST)){
  9.                 $scan_command .= ' --mode ' . $_POST['mode'];
  10.         }
  11.         if(array_key_exists('resolution',$_POST)){
  12.                 $scan_command .= ' --resolution ' . $_POST['resolution'];
  13.         }
  14.         if(array_key_exists('l',$_POST)){
  15.                 $scan_command .= ' -l ' . $_POST['l'];
  16.         }
  17.         if(array_key_exists('t',$_POST)){
  18.                 $scan_command .= ' -t ' . $_POST['t'];
  19.         }
  20.         if(array_key_exists('x',$_POST)){
  21.                 $scan_command .= ' -x ' . $_POST['x'];
  22.         }
  23.         if(array_key_exists('y',$_POST)){
  24.                 $scan_command .= ' -y ' . $_POST['y'];
  25.         }
  26.         system("$scan_command | convert ppm:- images/$filename");
  27.  
  28.         header("Content-Type: text/javascript");
  29.         echo '{"success":true,"file_name":"'.$filename.'"}';
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement