问题
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