FIX: raise an exception when 'downsize'git st fails

This commit is contained in:
Régis Hanol 2018-08-16 19:20:07 +02:00
parent 7af0da9498
commit 98898ff4b3

View File

@ -187,8 +187,18 @@ class UploadCreator
3.times do
original_size = filesize
downsized_pixels = [pixels, max_image_pixels].min / 2
OptimizedImage.downsize(@file.path, @file.path, "#{downsized_pixels}@", filename: @filename, allow_animation: allow_animation)
OptimizedImage.downsize(
@file.path,
@file.path,
"#{downsized_pixels}@",
filename: @filename,
allow_animation: allow_animation,
raise_on_error: true
)
extract_image_info!
return if filesize >= original_size || pixels == 0 || !should_downsize?
end
end