﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24441	core.files.images.get_image_dimensions broken	artscoop	nobody	"Each time you access a model instance which contains an `ImageField`, `core.files.images.get_image_dimensions` is called. I have always found it overkill but whatever.
The bug is that the function chokes because `get_image_dimensions` returns `None` on a valid image (which is a 1x1 BMP32ARGB, not recognized by Pillow).
I end with a 
{{{
>> return self._get_image_dimensions()[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
}}}

When hitting an unrecognized image file, the function should still return a tuple like `(0, 0)` or `(-1, -1)` (but it returns `None`). I changed the function code to this:
{{{
    from PIL import Image
    try:
        image = Image.open(file_or_path)
        return image.size  # raster data is not loaded here
    except IOError:
        return [-1, -1]
}}}
what do you think ? It appears as a bug to me."	Bug	new	Core (Other)	1.7	Normal		imagefield, imagefilefield		Unreviewed	0	0	0	0	0	0
