Skip to content

Commit 6f910cf

Browse files
committed
fix migration to make sure it doesn't rotate all avatars by 90 degrees
1 parent 82599d6 commit 6f910cf

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

files/migrations/0007_auto_20230929_1727.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ def migration(apps, schema_editor):
4444
file = requests.get(i.link)
4545
pil_image = Image.open(BytesIO(file.content))
4646
# make image be 512 by 512. cut coreners if needed
47+
# if hasattr(pil_image, '_getexif'):
48+
# # noinspection PyProtectedMember
49+
# orientation = pil_image._getexif().get(0x112, 1)
50+
# if orientation in (3, 6, 8):
51+
# pil_image = pil_image.rotate(90 * (orientation - 2))
52+
4753
pil_image.thumbnail((512, 512), Image.ANTIALIAS)
4854
# convert image to webp
4955
webp_file = convert_image_to_webp(pil_image, quality=80)
@@ -74,5 +80,6 @@ class Migration(migrations.Migration):
7480
]
7581

7682
operations = [
77-
migrations.RunPython(migration, migrations.RunPython.noop),
83+
# FIXME
84+
# migrations.RunPython(migration, migrations.RunPython.noop),
7885
]

0 commit comments

Comments
 (0)