web/lib/django/core/files/images.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
--- a/web/lib/django/core/files/images.py	Wed May 19 17:43:59 2010 +0200
+++ b/web/lib/django/core/files/images.py	Tue May 25 02:43:45 2010 +0200
@@ -30,7 +30,12 @@
 
 def get_image_dimensions(file_or_path):
     """Returns the (width, height) of an image, given an open file or a path."""
-    from PIL import ImageFile as PILImageFile
+    # Try to import PIL in either of the two ways it can end up installed.
+    try:
+        from PIL import ImageFile as PILImageFile
+    except ImportError:
+        import ImageFile as PILImageFile
+        
     p = PILImageFile.Parser()
     close = False
     if hasattr(file_or_path, 'read'):