Fix for regeneration task
This commit is contained in:
parent
62b0bea131
commit
cefdeddd2e
@ -29,4 +29,26 @@ class CoverUploader < CarrierWave::Uploader::Base
|
|||||||
image['width'] > image['height']
|
image['width'] > image['height']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def manipulate!
|
||||||
|
cache_stored_file! if !cached?
|
||||||
|
image = ::MiniMagick::Image.open(current_path)
|
||||||
|
|
||||||
|
begin
|
||||||
|
image.format(@format.to_s.downcase) if @format
|
||||||
|
image = yield(image)
|
||||||
|
image.write(current_path)
|
||||||
|
begin
|
||||||
|
image.run_command("identify", current_path)
|
||||||
|
rescue
|
||||||
|
image.run_command("identify", '"' + current_path + '"')
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
image.destroy!
|
||||||
|
end
|
||||||
|
rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e
|
||||||
|
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)
|
||||||
|
raise CarrierWave::ProcessingError, message
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -47,7 +47,11 @@ class PosterUploader < CarrierWave::Uploader::Base
|
|||||||
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", Gem.win_platform? ? '"' + current_path + '"' : current_path)
|
begin
|
||||||
|
image.run_command("identify", current_path)
|
||||||
|
rescue
|
||||||
|
image.run_command("identify", '"' + current_path + '"')
|
||||||
|
end
|
||||||
ensure
|
ensure
|
||||||
image.destroy!
|
image.destroy!
|
||||||
end
|
end
|
||||||
|
@ -3,11 +3,8 @@ namespace :regenerate do
|
|||||||
|
|
||||||
task conference_posters: :environment do
|
task conference_posters: :environment do
|
||||||
Conference.all.each { |m|
|
Conference.all.each { |m|
|
||||||
#puts m.title
|
|
||||||
#puts m.poster
|
|
||||||
m.poster.recreate_versions!
|
m.poster.recreate_versions!
|
||||||
}
|
}
|
||||||
#puts Conference.all.to_json.to_s
|
|
||||||
end
|
end
|
||||||
|
|
||||||
task organization_avatars: :environment do
|
task organization_avatars: :environment do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user