Permalink
Browse files

take content-type from response

  • Loading branch information...
1 parent 36bd3be commit ca41840e94ec1423be747491c8b823de49ea36e9 @ghostganz ghostganz committed Mar 15, 2012
Showing with 6 additions and 3 deletions.
  1. +4 −0 lib/imageproxy/convert.rb
  2. +2 −3 lib/imageproxy/server.rb
@@ -23,6 +23,10 @@ def etag
end
end
end
+
+ def content_type
+ source_headers[:content_type]
+ end
end
def initialize(options)
View
@@ -1,6 +1,5 @@
require File.join(File.expand_path(File.dirname(__FILE__)), "options")
require File.join(File.expand_path(File.dirname(__FILE__)), "convert")
-require File.join(File.expand_path(File.dirname(__FILE__)), "identify")
require File.join(File.expand_path(File.dirname(__FILE__)), "identify_format")
require File.join(File.expand_path(File.dirname(__FILE__)), "selftest")
require File.join(File.expand_path(File.dirname(__FILE__)), "signature")
@@ -40,7 +39,7 @@ def call(env)
headers = {"Cache-Control" => "public, max-age=#{cachetime}, must-revalidate",
"Content-Length" => image_blob.bytesize.to_s,
- "Content-Type" => 'image/jpeg'}
+ "Content-Type" => converted_image.content_type}
if converted_image.etag
quoted_original_etag = converted_image.etag.tr('"', '')
@@ -55,7 +54,7 @@ def call(env)
end
rescue
STDERR.puts $!
- STDERR.puts $!.backtrace.join("\n") if config?(:verbose)
+ STDERR.puts $!.backtrace.join("\n")
[500, {"Content-Type" => "text/plain"}, ["Error (#{$!})"]]
end

0 comments on commit ca41840

Please sign in to comment.