Skip to content

Commit

Permalink
www/seahub: Patch for new version of Pillow
Browse files Browse the repository at this point in the history
PR: 272942
Reported by: Scott Kitchin (scott@kitchin.com), Boris Tassou (boris.tassou@securmail.fr)
Submitted by: sunpoet
Obtained from: Seafile
  • Loading branch information
Richard Gallamore authored and Richard Gallamore committed Aug 26, 2023
1 parent 9549a20 commit ffaa8cd
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion www/seahub/Makefile
Expand Up @@ -2,6 +2,7 @@ PORTNAME= seahub
DISTVERSIONPREFIX= v
DISTVERSION= ${SEAHUB_VER}
DISTVERSIONSUFFIX= -server
PORTREVISION= 1
CATEGORIES= www

MAINTAINER= ultima@FreeBSD.org
Expand Down Expand Up @@ -29,7 +30,7 @@ RUN_DEPENDS= bash:shells/bash \
${PYTHON_PKGNAMEPREFIX}djangorestframework>=0:www/py-djangorestframework@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dateutil>=0:devel/py-dateutil@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}requests>=0:www/py-requests@${PY_FLAVOR} \
${PY_PILLOW} \
${PYTHON_PKGNAMEPREFIX}pillow>=0:graphics/py-pillow@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pyjwt>=0:www/py-pyjwt@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pycryptodome>=3.12.0:security/py-pycryptodome@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}requests-oauthlib>=0:www/py-requests-oauthlib@${PY_FLAVOR} \
Expand Down
50 changes: 50 additions & 0 deletions www/seahub/files/patch-pillow
@@ -0,0 +1,50 @@
Obtained from: https://github.com/haiwen/seahub/commit/cbe0817f2bee0c2b00d3ffd3e047c3141862c6c5

--- seahub/avatar/settings.py.orig 2022-11-30 03:34:16 UTC
+++ seahub/avatar/settings.py
@@ -22,7 +22,7 @@ AUTO_GENERATE_GROUP_AVATAR_SIZES = getattr(settings, '

### Common settings ###
AVATAR_FILE_STORAGE = getattr(settings, 'AVATAR_FILE_STORAGE', '')
-AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.ANTIALIAS)
+AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.Resampling.LANCZOS)
AVATAR_GRAVATAR_BACKUP = getattr(settings, 'AVATAR_GRAVATAR_BACKUP', True)
AVATAR_GRAVATAR_DEFAULT = getattr(settings, 'AVATAR_GRAVATAR_DEFAULT', None)
AVATAR_MAX_AVATARS_PER_USER = getattr(settings, 'AVATAR_MAX_AVATARS_PER_USER', 42)
--- seahub/thumbnail/utils.py.orig 2022-11-30 03:34:16 UTC
+++ seahub/thumbnail/utils.py
@@ -54,22 +54,22 @@ def get_rotated_image(image):

if orientation == 2:
# Vertical image
- image = image.transpose(Image.FLIP_LEFT_RIGHT)
+ image = image.transpose(Image.Transpose.FLIP_LEFT_RIGHT)
elif orientation == 3:
# Rotation 180
image = image.rotate(180)
elif orientation == 4:
- image = image.rotate(180).transpose(Image.FLIP_LEFT_RIGHT)
+ image = image.rotate(180).transpose(Image.Transpose.FLIP_LEFT_RIGHT)
# Horizontal image
elif orientation == 5:
# Horizontal image + Rotation 90 CCW
- image = image.rotate(-90, expand=True).transpose(Image.FLIP_LEFT_RIGHT)
+ image = image.rotate(-90, expand=True).transpose(Image.Transpose.FLIP_LEFT_RIGHT)
elif orientation == 6:
# Rotation 270
image = image.rotate(-90, expand=True)
elif orientation == 7:
# Horizontal image + Rotation 270
- image = image.rotate(90, expand=True).transpose(Image.FLIP_LEFT_RIGHT)
+ image = image.rotate(90, expand=True).transpose(Image.Transpose.FLIP_LEFT_RIGHT)
elif orientation == 8:
# Rotation 90
image = image.rotate(90, expand=True)
@@ -230,7 +230,7 @@ def _create_thumbnail_common(fp, thumbnail_file, size)
image = image.convert("RGB")

image = get_rotated_image(image)
- image.thumbnail((size, size), Image.ANTIALIAS)
+ image.thumbnail((size, size), Image.Resampling.LANCZOS)
image.save(thumbnail_file, THUMBNAIL_EXTENSION)
return (True, 200)

0 comments on commit ffaa8cd

Please sign in to comment.