|
@ -39,22 +39,22 @@ class PosterUploader < CarrierWave::Uploader::Base |
|
|
image['width'] > image['height'] |
|
|
image['width'] > image['height'] |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def manipulate! |
|
|
# def manipulate! |
|
|
cache_stored_file! if !cached? |
|
|
# cache_stored_file! if !cached? |
|
|
image = ::MiniMagick::Image.open(current_path) |
|
|
# image = ::MiniMagick::Image.open(current_path) |
|
|
|
|
|
# |
|
|
begin |
|
|
# begin |
|
|
image.format(@format.to_s.downcase) if @format |
|
|
# image.format(@format.to_s.downcase) if @format |
|
|
image = yield(image) |
|
|
# image = yield(image) |
|
|
image.write(current_path) |
|
|
# image.write(current_path) |
|
|
image.run_command("identify", '"' + current_path + '"') |
|
|
# image.run_command("identify", '"' + current_path + '"') |
|
|
ensure |
|
|
# ensure |
|
|
image.destroy! |
|
|
# image.destroy! |
|
|
end |
|
|
# end |
|
|
rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e |
|
|
# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e |
|
|
default = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en) |
|
|
# default = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en) |
|
|
message = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => default) |
|
|
# message = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => default) |
|
|
raise CarrierWave::ProcessingError, message |
|
|
# raise CarrierWave::ProcessingError, message |
|
|
end |
|
|
# end |
|
|
|
|
|
|
|
|
end |
|
|
end |
|
|