diff options
author | spag <spag@golwen.net> | 2013-02-19 14:09:11 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-02-19 14:09:11 +0100 |
commit | 4715082b46073d7ca4108b1093d2304eb5999e1b (patch) | |
tree | a8e6df469c75935b527b21415399610914fdafd5 /app/controllers/fax_documents_controller.rb | |
parent | 22d581aa38ae4e015c654356fb61d110456e69ee (diff) |
tiff download
Diffstat (limited to 'app/controllers/fax_documents_controller.rb')
-rw-r--r-- | app/controllers/fax_documents_controller.rb | 18 |
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 |