Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Don't import PIL until needed so that systems without PIL don't barf.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6f6024751c26ef054fec23f05746640bb0fcc5d1 1 parent 84afcf5
@jacobian jacobian authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/core/files/
4 django/core/files/
@@ -4,7 +4,6 @@
Requires PIL, as you might imagine.
-from PIL import ImageFile as PIL
from django.core.files import File
class ImageFile(File):
@@ -27,7 +26,8 @@ def _get_image_dimensions(self):
def get_image_dimensions(file_or_path):
"""Returns the (width, height) of an image, given an open file or a path."""
- p = PIL.Parser()
+ from PIL import ImageFile as PILImageFile
+ p = PILImageFile.Parser()
if hasattr(file_or_path, 'read'):
file = file_or_path

0 comments on commit 6f60247

Please sign in to comment.
Something went wrong with that request. Please try again.