From 3cc3a365c1949317f778315db4585c36d73c8409 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Fri, 2 Dec 2022 16:38:29 -0800 Subject: [PATCH] troubleshooting nsfw filter for gif --- nerochan/models.py | 8 +++----- nerochan/templates/artwork/show.html | 21 +++++++++------------ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/nerochan/models.py b/nerochan/models.py index f68a801..ee4097d 100644 --- a/nerochan/models.py +++ b/nerochan/models.py @@ -114,20 +114,18 @@ class Artwork(pw.Model): _frames = thumbnails(frames) _image = next(_frames) _image.info = image.info - - _image.save(t, format=image.format, save_all=True, append_images=list(_frames), disposal=2) + _image.save(t, save_all=True, append_images=list(_frames), disposal=2) else: image.thumbnail(size, Image.ANTIALIAS) if self.nsfw: image = image.filter(ImageFilter.GaussianBlur(radius = 4)) image.save(t, format=image.format) - - image.close() self.thumbnail = _t self.save() return True - except: + except Exception as e: + print(e) return False class Meta: diff --git a/nerochan/templates/artwork/show.html b/nerochan/templates/artwork/show.html index deb3e80..7c5b813 100644 --- a/nerochan/templates/artwork/show.html +++ b/nerochan/templates/artwork/show.html @@ -11,19 +11,16 @@

{{ artwork.description }}

- {% if not artwork.approved %} - {% if artwork.hidden %} - - {% else %} - - {% endif %} - - - {% endif %} {% if current_user.is_authenticated and current_user.is_admin %} - - - + + {% endif %} + {% if not artwork.approved %} + {% if artwork.hidden %} + + {% else %} + + {% endif %} + {% endif %}