From f4f9fb5df32484ae7ba596a3c8a4cb131c79748b Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Wed, 31 Jan 2018 16:50:30 -0500 Subject: [PATCH] Correct orientation detection --- activestorage/lib/active_storage/analyzer/image_analyzer.rb | 2 +- activestorage/test/analyzer/image_analyzer_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/activestorage/lib/active_storage/analyzer/image_analyzer.rb b/activestorage/lib/active_storage/analyzer/image_analyzer.rb index 7342178eff..3b39de91be 100644 --- a/activestorage/lib/active_storage/analyzer/image_analyzer.rb +++ b/activestorage/lib/active_storage/analyzer/image_analyzer.rb @@ -39,7 +39,7 @@ def read_image end def rotated_image?(image) - %w[ RightTop LeftBottom ].include?(image["orientation"]) + %w[ RightTop LeftBottom ].include?(image["%[orientation]"]) end end end diff --git a/activestorage/test/analyzer/image_analyzer_test.rb b/activestorage/test/analyzer/image_analyzer_test.rb index f04ed63c3c..f8a38f001a 100644 --- a/activestorage/test/analyzer/image_analyzer_test.rb +++ b/activestorage/test/analyzer/image_analyzer_test.rb @@ -18,8 +18,8 @@ class ActiveStorage::Analyzer::ImageAnalyzerTest < ActiveSupport::TestCase blob = create_file_blob(filename: "racecar_rotated.jpg", content_type: "image/jpeg") metadata = extract_metadata_from(blob) - assert_equal 4104, metadata[:width] - assert_equal 2736, metadata[:height] + assert_equal 2736, metadata[:width] + assert_equal 4104, metadata[:height] end test "analyzing an SVG image without an XML declaration" do -- GitLab