Image attachments are now sent inline to be viewed directly in the browser.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@642 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -19,18 +19,13 @@ class AttachmentsController < ApplicationController
|
||||
layout 'base'
|
||||
before_filter :find_project, :check_project_privacy
|
||||
|
||||
# sends an attachment
|
||||
def download
|
||||
send_file @attachment.diskfile, :filename => @attachment.filename
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
|
||||
# sends an image to be displayed inline
|
||||
def show
|
||||
render(:nothing => true, :status => 404) and return unless @attachment.diskfile =~ /\.(jpeg|jpg|gif|png)$/i
|
||||
send_file @attachment.diskfile, :filename => @attachment.filename, :type => "image/#{$1}", :disposition => 'inline'
|
||||
# images are sent inline
|
||||
send_file @attachment.diskfile, :filename => @attachment.filename,
|
||||
:type => @attachment.content_type,
|
||||
:disposition => (@attachment.image? ? 'inline' : 'attachment')
|
||||
rescue
|
||||
# in case the disk file was deleted
|
||||
render_404
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user