Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
www/seahub: Patch for new version of Pillow
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
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |