fix orientation problem
This commit is contained in:
parent
863d89e46b
commit
605c7d467f
|
@ -32,6 +32,11 @@ class GalleryUploader < CarrierWave::Uploader::Base
|
||||||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fix_exif_rotation
|
||||||
|
manipulate! do |img|
|
||||||
|
img.tap(&:auto_orient)
|
||||||
|
end
|
||||||
|
end
|
||||||
# Provide a default URL as a default if there hasn't been a file uploaded:
|
# Provide a default URL as a default if there hasn't been a file uploaded:
|
||||||
# def default_url
|
# def default_url
|
||||||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||||
|
@ -50,14 +55,17 @@ class GalleryUploader < CarrierWave::Uploader::Base
|
||||||
# end
|
# end
|
||||||
|
|
||||||
version :thumb do
|
version :thumb do
|
||||||
|
process :fix_exif_rotation
|
||||||
process :resize_to_fill => [200, 200]
|
process :resize_to_fill => [200, 200]
|
||||||
end
|
end
|
||||||
|
|
||||||
version :theater do
|
version :theater do
|
||||||
|
process :fix_exif_rotation
|
||||||
process :resize_to_limit => [1920, 1080]
|
process :resize_to_limit => [1920, 1080]
|
||||||
end
|
end
|
||||||
|
|
||||||
version :mobile do
|
version :mobile do
|
||||||
|
process :fix_exif_rotation
|
||||||
process :resize_to_limit => [1152, 768]
|
process :resize_to_limit => [1152, 768]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -81,6 +89,6 @@ class GalleryUploader < CarrierWave::Uploader::Base
|
||||||
# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e
|
# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e
|
||||||
# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}")
|
# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}")
|
||||||
# end
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue