~adamzammit/quexf/main

« back to all changes in this revision

Viewing changes to functions/functions.import.php

  • Committer: Adam Zammit
  • Date: 2014-07-16 02:28:24 UTC
  • Revision ID: adam.zammit@acspri.org.au-20140716022824-sjgipkswkfwyi5ij
New Feature: Allow for images from scanned forms to be stored as files instead of in the database

Show diffs side-by-side

added added

removed removed

Lines of Context:
832
832
                        
833
833
                                                        //calc transforms
834
834
                                                        $transforms = detecttransforms($image,$page);
835
 
        
 
835
 
 
836
              $imagedata = '';
 
837
              $imagefilename = '';
 
838
 
 
839
              if (IMAGES_IN_DATABASE)
 
840
              {
 
841
                $imagedata = addslashes($data);
 
842
              }
 
843
              else
 
844
              {
 
845
                $imagefilename = $fid . "-" . $page['pid'] . ".png";
 
846
                imagepng($image,IMAGES_DIRECTORY . $imagefilename);
 
847
              }
 
848
 
836
849
                                                        //save image to db including offset
837
850
                                                        $sql = "INSERT INTO formpages
838
851
                                                                (fid,pid,filename,image";
841
854
                                                                $sql .= ",$key";
842
855
        
843
856
                                                        $sql .= ")
844
 
                                                                VALUES ('$fid','{$page["pid"]}','','" . addslashes($data) . "'";
 
857
                                                                VALUES ('$fid','{$page["pid"]}','$imagefilename','" . $imagedata . "'";
845
858
        
846
859
                                                        foreach($transforms as $key => $val)
847
860
                                                                $sql .= ",'$val'";
884
897
        
885
898
                                unset($data);
886
899
                                unset($image);
 
900
                                unset($imagedata);
887
901
                                unset($barcode);
888
902
                        }       
889
903
                        $n++;