1
0
mirror of https://github.com/django/django.git synced 2024-12-26 11:06:07 +00:00

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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8249 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2008-08-08 21:57:25 +00:00
parent 84afcf5a02
commit 6f6024751c

View File

@ -4,7 +4,6 @@ Utility functions for handling images.
Requires PIL, as you might imagine. Requires PIL, as you might imagine.
""" """
from PIL import ImageFile as PIL
from django.core.files import File from django.core.files import File
class ImageFile(File): class ImageFile(File):
@ -27,7 +26,8 @@ class ImageFile(File):
def get_image_dimensions(file_or_path): def get_image_dimensions(file_or_path):
"""Returns the (width, height) of an image, given an open file or a 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'): if hasattr(file_or_path, 'read'):
file = file_or_path file = file_or_path
else: else: