Merge pull request #4363 from kepstin/bbb-20-rec-fixes

RnP: Don't fail processing if an image can't be converted to png
This commit is contained in:
Richard Alam 2017-09-05 14:18:31 -04:00 committed by GitHub
commit 139cdd9b0f
2 changed files with 8 additions and 4 deletions

View File

@ -71,7 +71,12 @@ module BigBlueButton
def self.convert_image_to_png(image, png_image, resize = '800x600') def self.convert_image_to_png(image, png_image, resize = '800x600')
BigBlueButton.logger.info("Task: Converting image to .png") BigBlueButton.logger.info("Task: Converting image to .png")
command = "convert #{image} -resize #{resize} -background white -flatten #{png_image}" command = "convert #{image} -resize #{resize} -background white -flatten #{png_image}"
BigBlueButton.execute(command) status = BigBlueButton.execute(command, false)
if !status.success? or !File.exist?(png_image)
# If image conversion failed, generate a blank white image
command = "convert -size #{resize} xc:white -quality 90 +dither -depth 8 -colors 256 #{png_image}"
BigBlueButton.execute(command)
end
end end
# Gathers the text from the slide # Gathers the text from the slide

View File

@ -190,9 +190,8 @@ if not FileTest.directory?(target_dir)
end end
else else
ext = File.extname("#{images[0]}") ext = File.extname("#{images[0]}")
#BigBlueButton::Presentation.convert_image_to_png(images[0],"#{target_pres_dir}/slide-1.png") BigBlueButton::Presentation.convert_image_to_png(
command="convert #{images[0]} -resize 1600x1200 -background white -flatten #{target_pres_dir}/slide-1.png" images[0], "#{target_pres_dir}/slide-1.png", '1600x1200')
BigBlueButton.execute(command)
end end
# Copy thumbnails from raw files # Copy thumbnails from raw files