mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-11 18:56:23 +00:00
Implement the pagan lib (for fun)
This commit is contained in:
@@ -18,7 +18,7 @@ from PIL import Image
|
||||
from monsterid.id import build_monster as BuildMonster
|
||||
import Identicon
|
||||
from pydenticon5 import Pydenticon5
|
||||
|
||||
import pagan
|
||||
from robohash import Robohash
|
||||
|
||||
from ivatar.settings import AVATAR_MAX_SIZE, JPEG_QUALITY, DEFAULT_AVATAR_SIZE
|
||||
@@ -166,6 +166,15 @@ class AvatarImageView(TemplateView):
|
||||
data,
|
||||
content_type='image/png')
|
||||
|
||||
if str(default) == 'pagan':
|
||||
img = pagan.Avatar(kwargs['digest'])
|
||||
data = BytesIO()
|
||||
img.img.save(data, 'PNG', quality=JPEG_QUALITY)
|
||||
data.seek(0)
|
||||
return HttpResponse(
|
||||
data,
|
||||
content_type='image/png')
|
||||
|
||||
if str(default) == 'identicon':
|
||||
p = Pydenticon5()
|
||||
# In order to make use of the whole 32 bytes digest, we need to redigest them.
|
||||
|
||||
@@ -37,3 +37,4 @@ git+https://github.com/ofalk/Robohash.git@devel
|
||||
python-memcached
|
||||
git+https://github.com/ercpe/pydenticon5.git
|
||||
git+https://github.com/flavono123/identicon.git
|
||||
pagan
|
||||
|
||||
Reference in New Issue
Block a user