summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/fax_documents_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/fax_documents_controller.rb b/app/controllers/fax_documents_controller.rb
index 5653683..c2b3083 100644
--- a/app/controllers/fax_documents_controller.rb
+++ b/app/controllers/fax_documents_controller.rb
@@ -31,6 +31,24 @@ class FaxDocumentsController < ApplicationController
)
end
}
+ format.tiff {
+ caller_number = @fax_document.caller_id_number.to_s.gsub(/[^0-9]/, '')
+ if caller_number.blank?
+ caller_number = 'anonymous'
+ end
+
+ if @fax_document.tiff
+ send_file @fax_document.tiff, :type => "image/tiff",
+ :filename => "#{@fax_document.created_at.strftime('%Y%m%d-%H%M%S')}-#{caller_number}.tiff"
+ else
+ render(
+ :status => 404,
+ :layout => false,
+ :content_type => 'text/plain',
+ :text => "<!-- Raw image not found -->",
+ )
+ end
+ }
end
end