diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-03-07 11:37:03 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-03-07 11:37:03 +0100 |
commit | 11f186a118285fbc87a536af26730780a9ad01f5 (patch) | |
tree | fe6363b036f60f238916d070b3d0cb0625dd53c8 /app/models/fax_document.rb | |
parent | 2b94b16ee1201d15b3b9d66e142df311141a47db (diff) | |
parent | 3e19646f46c772e10ed3d7a45e8c974ab23f625b (diff) |
Merge branch 'develop'5.1.1
Diffstat (limited to 'app/models/fax_document.rb')
-rw-r--r-- | app/models/fax_document.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/fax_document.rb b/app/models/fax_document.rb index 5b27965..3cb92ea 100644 --- a/app/models/fax_document.rb +++ b/app/models/fax_document.rb @@ -96,9 +96,18 @@ class FaxDocument < ActiveRecord::Base page_size_command = "<< /Policies << /PageSize 3 >> /InputAttributes currentpagedevice /InputAttributes get dup { pop 1 index exch undef } forall dup 0 << /PageSize [ #{page_size_a4} ] >> put >> setpagedevice" working_path, file_name = File.split(self.document.to_s) tiff_file = File.basename(file_name.to_s.downcase, File.extname(file_name)) + '.tiff' - result = system "cd #{store_dir} && gs -q -r#{self.fax_resolution.resolution_value} -dNOPAUSE -dBATCH -dSAFER -sDEVICE=tiffg3 -sOutputFile=\"#{tiff_file}\" -c \"#{page_size_command}\" -- \"#{self.document.to_s}\"" + result = system "cd #{store_dir} && gs -q -r#{self.fax_resolution.resolution_value} -dNOPAUSE -dBATCH -dSAFER -sDEVICE=tiffg3 -sOutputFile=\"#{store_dir}/#{tiff_file}\" -c \"#{page_size_command}\" -- \"#{self.document.to_s}\"" if !File.exists?("#{store_dir}/#{tiff_file}") + page_size = "1728x1078" or "1728x1186"; + command = "cd #{store_dir} && convert -quiet -density #{self.fax_resolution.resolution_value} -units PixelsPerInch -resize #{page_size}\! -monochrome -compress Fax \"#{self.document.to_s}\" \"#{store_dir}/#{tiff_file}\"" + result = system(command) + if result.nil? + logger.error "### FAX_DOCUMENT_TO_TIFF - error: #{$?}, command: #{command}" + end + end + + if !File.exists?("#{store_dir}/#{tiff_file}") return nil end |