Project

General

Profile

Images are not opened in the browser

Added by Vladimir Stretovich over 7 years ago

Images are not opened in the browser But they load
how to remove Content-Disposition: attachment; for png, jpeg, etc...

HTTP/1.1 200 OK
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 28 Apr 2017 09:34:04 GMT
Content-Type: image/jpeg
Connection: keep-alive
Status: 200 OK
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
ETag: "2bc691ff23ce425183a641808c4f2d6d"
Content-Disposition: attachment; filename="pac_screenshot_17532563,9518784.jpg"
Content-Transfer-Encoding: binary
Cache-Control: private

Environment:
  Redmine version                3.3.3.stable
  Ruby version                   2.0.0-p247 (2013-06-27) [x86_64-linux]
  Rails version                  4.2.7.1
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.8
  Git                            1.9.1
  Filesystem                     
Redmine plugins:
  redmine_lightbox2              0.3.2
  redmine_plugin_views_revisions 0.0.1
  redmine_revision_branches      0.3.1
  redmine_tagging                0.1.3
  view_customize                 1.1.2


Replies (1)

RE: Images are not opened in the browser RESOLV - Added by Vladimir Stretovich over 7 years ago

ver 3.1

if stale?(:etag => @attachment.digest)
      # images are sent inline
      send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
                                      :type => detect_content_type(@attachment),
                                      :disposition => (@attachment.image? ? 'inline' : 'attachment')

end

ver 3.3

if stale?(:etag => @attachment.digest)
      # images are sent inline
      send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
                                      :type => detect_content_type(@attachment),
                                      :disposition => (@attachment)

end
    (1-1/1)