通过 carreirwave/dropzone 移动设备上传的照片在 s3 中正确旋转,但在我的网络应用程序中显示为横向
Photos uploaded by mobile with carreirwave/dropzone are rotated correctly in s3 but are showing up sideways on my webapp
当用户使用手机 phone 使用 Carrierwave/Dropzone 上传照片时,照片有时会在预览中横向显示,但照片会以正确的旋转方式保存在 s3 中。然而,尽管以正确的旋转方式保存在 s3 中,但当它们随后显示在网络应用程序上时,它们再次被横向显示。非常混乱。
这是让它工作的代码
class AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
process :auto_orient
def auto_orient
manipulate! do |image|
image.tap(&:auto_orient)
end
end
end
旁注:auto_orient
无法追溯,需要重新上传图像才能使其具有正确的方向。
当用户使用手机 phone 使用 Carrierwave/Dropzone 上传照片时,照片有时会在预览中横向显示,但照片会以正确的旋转方式保存在 s3 中。然而,尽管以正确的旋转方式保存在 s3 中,但当它们随后显示在网络应用程序上时,它们再次被横向显示。非常混乱。
这是让它工作的代码
class AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
process :auto_orient
def auto_orient
manipulate! do |image|
image.tap(&:auto_orient)
end
end
end
旁注:auto_orient
无法追溯,需要重新上传图像才能使其具有正确的方向。