troubleshooting nsfw filter for gif

master
lza_menace 2 years ago
parent 44d1201de7
commit 3cc3a365c1

@ -114,20 +114,18 @@ class Artwork(pw.Model):
_frames = thumbnails(frames) _frames = thumbnails(frames)
_image = next(_frames) _image = next(_frames)
_image.info = image.info _image.info = image.info
_image.save(t, save_all=True, append_images=list(_frames), disposal=2)
_image.save(t, format=image.format, save_all=True, append_images=list(_frames), disposal=2)
else: else:
image.thumbnail(size, Image.ANTIALIAS) image.thumbnail(size, Image.ANTIALIAS)
if self.nsfw: if self.nsfw:
image = image.filter(ImageFilter.GaussianBlur(radius = 4)) image = image.filter(ImageFilter.GaussianBlur(radius = 4))
image.save(t, format=image.format) image.save(t, format=image.format)
image.close() image.close()
self.thumbnail = _t self.thumbnail = _t
self.save() self.save()
return True return True
except: except Exception as e:
print(e)
return False return False
class Meta: class Meta:

@ -11,19 +11,16 @@
</h6> </h6>
<p class="artworkDescription">{{ artwork.description }}</p> <p class="artworkDescription">{{ artwork.description }}</p>
<div class="row"> <div class="row">
{% if not artwork.approved %}
{% if artwork.hidden %}
<a href="{{ url_for('artwork.manage', id=artwork.id, action='delete') }}"><button class="button-secondary">Delete</button></a>
{% else %}
<a href="{{ url_for('artwork.manage', id=artwork.id, action='reject') }}"><button class="button">Reject</button></a>
{% endif %}
<a href="{{ url_for('artwork.manage', id=artwork.id, action='approve') }}"><button class="button-primary">Approve</button></a>
{% endif %}
{% if current_user.is_authenticated and current_user.is_admin %} {% if current_user.is_authenticated and current_user.is_admin %}
<span class="ml-4"> <a href="{{ url_for('artwork.manage', id=artwork.id, action='regenerate_thumbnail') }}"><button class="button">Regen Thumbnail</button></a>
<a href="{{ url_for('artwork.manage', id=artwork.id, action='regenerate_thumbnail') }}"><button class="button">Regen Thumbnail</button></a> {% endif %}
</span> {% if not artwork.approved %}
{% if artwork.hidden %}
<a href="{{ url_for('artwork.manage', id=artwork.id, action='delete') }}"><button class="button-secondary">Delete</button></a>
{% else %}
<a href="{{ url_for('artwork.manage', id=artwork.id, action='reject') }}"><button class="button">Reject</button></a>
{% endif %}
<a href="{{ url_for('artwork.manage', id=artwork.id, action='approve') }}"><button class="button-primary">Approve</button></a>
{% endif %} {% endif %}
</div> </div>
</div> </div>

Loading…
Cancel
Save