diff --git a/sigal/gallery.py b/sigal/gallery.py index b762e6c..6ce8901 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -109,9 +109,13 @@ class Media(UnicodeMixin): generator = video.generate_thumbnail self.logger.debug('Generating thumbnail for %r', self) - generator(self.src_path, self.thumb_path, - self.settings['thumb_size'], - fit=self.settings['thumb_fit']) + try: + generator(self.src_path, self.thumb_path, + self.settings['thumb_size'], + fit=self.settings['thumb_fit']) + except Exception as e: + self.logger.error('Failed to generate thumbnail: %s', e) + return return self.thumb_name diff --git a/sigal/image.py b/sigal/image.py index 8499039..e1bc117 100644 --- a/sigal/image.py +++ b/sigal/image.py @@ -128,6 +128,7 @@ def generate_thumbnail(source, outname, box, fit=True, options=None): def process_image(filepath, outpath, settings): """Process one image: resize, create thumbnail.""" + logger = logging.getLogger(__name__) filename = os.path.split(filepath)[1] outname = os.path.join(outpath, filename) ext = os.path.splitext(filename)[1] @@ -139,7 +140,11 @@ def process_image(filepath, outpath, settings): else: options = {} - generate_image(filepath, outname, settings, options=options) + try: + generate_image(filepath, outname, settings, options=options) + except Exception as e: + logger.error('Failed to process image: %s', e) + return if settings['make_thumbs']: thumb_name = os.path.join(outpath, get_thumb(settings, filename))