Fixed problem with uploading .GIF files, as they need to be conditionally converted to RGB.

git-svn-id: http://django-avatar.googlecode.com/svn/trunk@23 c76b2324-5f53-0410-85ac-b1078a54aeeb
This commit is contained in:
Eric Florenzano 2008-08-16 05:48:33 +00:00
parent d29ebe0192
commit 559eb4ae99

View file

@ -64,6 +64,8 @@ class Avatar(models.Model):
image = image.crop((0, diff, w, h - diff))
image = image.resize((size, size), AVATAR_RESIZE_METHOD)
thumb = default_storage.open(self.avatar_path(size), 'wb')
if image.mode != "RGB":
image = image.convert("RGB")
image.save(thumb, "JPEG")
def avatar_url(self, size):