forked from OpenNeo/impress
on creating outfit image, skip broken images instead of throwing exception
This commit is contained in:
parent
2b88ce9b4b
commit
82c4a8d4b4
1 changed files with 10 additions and 4 deletions
|
@ -140,10 +140,16 @@ class Outfit < ActiveRecord::Base
|
||||||
unless image_layers.empty?
|
unless image_layers.empty?
|
||||||
temp_image_files = Parallel.map(image_layers, :in_threads => 8) do |swf_asset|
|
temp_image_files = Parallel.map(image_layers, :in_threads => 8) do |swf_asset|
|
||||||
image_file = Tempfile.open(['outfit_layer', '.png'])
|
image_file = Tempfile.open(['outfit_layer', '.png'])
|
||||||
|
begin
|
||||||
write_temp_swf_asset_image!(swf_asset, image_file)
|
write_temp_swf_asset_image!(swf_asset, image_file)
|
||||||
image_file.close
|
rescue RightAws::AwsError
|
||||||
|
nil # skip broken images
|
||||||
|
else
|
||||||
image_file
|
image_file
|
||||||
|
ensure
|
||||||
|
image_file.close
|
||||||
end
|
end
|
||||||
|
end.compact # remove nils for broken images
|
||||||
|
|
||||||
# Here we do some awkwardness to get the exact ImageMagick command we
|
# Here we do some awkwardness to get the exact ImageMagick command we
|
||||||
# want, though it's still less awkward than handling the command
|
# want, though it's still less awkward than handling the command
|
||||||
|
|
Loading…
Reference in a new issue