mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
@@ -641,7 +641,7 @@ class ImageField(FileField):
|
||||
if f is None:
|
||||
return None
|
||||
|
||||
from django.utils.image import Image
|
||||
from PIL import Image
|
||||
|
||||
# We need to get a file object for Pillow. We might have a path or we might
|
||||
# have to read the data into memory.
|
||||
@@ -659,7 +659,7 @@ class ImageField(FileField):
|
||||
# verify() must be called immediately after the constructor.
|
||||
Image.open(file).verify()
|
||||
except Exception:
|
||||
# Pillow (or PIL) doesn't recognize it as an image.
|
||||
# Pillow doesn't recognize it as an image.
|
||||
six.reraise(ValidationError, ValidationError(
|
||||
self.error_messages['invalid_image'],
|
||||
code='invalid_image',
|
||||
|
||||
Reference in New Issue
Block a user