Rails image_tag rotates image

北战南征 提交于 2019-12-04 13:11:38

in the uploader.rb file, try

process :auto_orient 

def auto_orient
 manipulate! do |image|
   image.tap(&:auto_orient)
 end
end

it should fix it.

Perhaps instead of trying to resize_to_limit, instead create a version that you would like to conform to. For example, if you wanted all pictures to "intelligently" downsize to a square, you could do something like this

remove from uploader:

process :resize_to_limit => [420, 0]

add to uploader:

version :portrait do process :resize_to_fit => [100, 100] end

this way, carrierwave will store the original image, and will then also respond to your call when you do something like this:

@idea.image_url(:portrait)

this is assuming that your Idea model mounts your ImageUploader and has all the other necessary stuff already configured.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!