Image displaying sideways

大城市里の小女人 提交于 2019-12-25 04:49:19

问题


I am using CarrierWave to upload an image. The image uploads fine. But any vertical image (only vertical images) displays sideways. How can I fix this?

    <div class="row">
        <div class="profile_picture">
            <%= image_tag @user.attachment.url %>
        </div>
    </div>

the image tag turns into:

<img src="/uploads/user/attachment/23/CIMG6610.JPG" alt="Cimg6610">

CSS:

.profile_picture {
    max-width: 100%;
    img {
        max-width: 100%;
    }
}

if I look at the upload directly in the browser "localhost:3000/uploads/user/attachment/23/CIMG6610.JPG" it displays correctly


回答1:


It seemed to be an issue with the upload. Adding this to my Uploader fixed the issue.

  process :auto_orient

  def auto_orient
    manipulate! do |img|
      img = img.auto_orient
    end
  end

Thanks @JohnDevelops



来源:https://stackoverflow.com/questions/30078003/image-displaying-sideways

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