Search code examples
ruby-on-railsruby-on-rails-6rails-activestorage

Rails Active Storage image variant flipped upside down


When rendering a rails active storage image variant as follows:

<%=image_tag(current_user.avatar.variant(resize_to_limit:[200, 200])) %>

The image gets flipped upside down. I have tried to remove the EXIF metadata by setting the auto_orient option as true like suggested here without success. This is definitely a rails bug because as soon as I remove the variant method, the original image displays correctly.

Note that I am uploading picture captured by iphone devices. Here is the image used.

System configuration: Rails version: 6.1.5 / Ruby version: 3.1.1p18


Solution

  • I've finally solved the problem by updating the backend the image_processing gem was using under the hood on my local machine (Apple Silicon, M1 chip). So, it was not really a rails issue, but something you should keep in mind when using Active storage variants.