mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-15 20:48:02 +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
|
from monsterid.id import build_monster as BuildMonster
|
||||||
import Identicon
|
import Identicon
|
||||||
from pydenticon5 import Pydenticon5
|
from pydenticon5 import Pydenticon5
|
||||||
|
import pagan
|
||||||
from robohash import Robohash
|
from robohash import Robohash
|
||||||
|
|
||||||
from ivatar.settings import AVATAR_MAX_SIZE, JPEG_QUALITY, DEFAULT_AVATAR_SIZE
|
from ivatar.settings import AVATAR_MAX_SIZE, JPEG_QUALITY, DEFAULT_AVATAR_SIZE
|
||||||
@@ -166,6 +166,15 @@ class AvatarImageView(TemplateView):
|
|||||||
data,
|
data,
|
||||||
content_type='image/png')
|
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':
|
if str(default) == 'identicon':
|
||||||
p = Pydenticon5()
|
p = Pydenticon5()
|
||||||
# In order to make use of the whole 32 bytes digest, we need to redigest them.
|
# 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
|
python-memcached
|
||||||
git+https://github.com/ercpe/pydenticon5.git
|
git+https://github.com/ercpe/pydenticon5.git
|
||||||
git+https://github.com/flavono123/identicon.git
|
git+https://github.com/flavono123/identicon.git
|
||||||
|
pagan
|
||||||
|
|||||||
Reference in New Issue
Block a user