fix rotation error

This commit is contained in:
2018-10-21 13:47:59 -07:00
parent 81661a5aa0
commit d85c53c688

View File

@@ -6,6 +6,7 @@ from django.contrib.auth.models import User
from django.core.files.base import ContentFile from django.core.files.base import ContentFile
from django.core.mail import send_mail from django.core.mail import send_mail
from django.template import loader from django.template import loader
from io import BytesIO
from PIL import Image from PIL import Image
from storages.backends.s3boto3 import S3Boto3Storage from storages.backends.s3boto3 import S3Boto3Storage
from stdimage.models import StdImageField from stdimage.models import StdImageField
@@ -47,7 +48,7 @@ def resizeAndRotate(file_name, variations, storage):
if rotated: if rotated:
with BytesIO() as file_buffer: with BytesIO() as file_buffer:
image.save(file_buffer, file_format) image.save(file_buffer, file_format)
f = ContentFile(file_buffer.getValue()) f = ContentFile(file_buffer.getvalue())
storage.delete(file_name) storage.delete(file_name)
storage.save(file_name, f) storage.save(file_name, f)
except: except: