mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
fix: resize method -> Image.LANCZOS
This commit is contained in:
parent
5bf5855f55
commit
5416cf88f2
1 changed files with 1 additions and 11 deletions
|
|
@ -1,21 +1,11 @@
|
|||
from appconf import AppConf
|
||||
from django.conf import settings
|
||||
from packaging.version import Version, parse
|
||||
from PIL import Image
|
||||
from PIL import __version__ as __pil_version__
|
||||
|
||||
if parse(__pil_version__) > Version("9.1.0"):
|
||||
# https://pillow.readthedocs.io/en/stable/deprecations.html#constants
|
||||
# https://github.com/jazzband/django-avatar/issues/222
|
||||
# Since 9.1.0, Image.ANTIALIAS is deprecated and replaced by Image.Resampling.LANCZOS and Image.LANCZOS
|
||||
_RESIZE_METHOD = Image.Resampling.LANCZOS
|
||||
else:
|
||||
_RESIZE_METHOD = Image.ANTIALIAS
|
||||
|
||||
|
||||
class AvatarConf(AppConf):
|
||||
DEFAULT_SIZE = 80
|
||||
RESIZE_METHOD = _RESIZE_METHOD
|
||||
RESIZE_METHOD = Image.LANCZOS
|
||||
STORAGE_DIR = "avatars"
|
||||
PATH_HANDLER = "avatar.models.avatar_path_handler"
|
||||
GRAVATAR_BASE_URL = "https://www.gravatar.com/avatar/"
|
||||
|
|
|
|||
Loading…
Reference in a new issue