Skip to content

Commit

Permalink
Merge pull request #61 from integricho/master
Browse files Browse the repository at this point in the history
fix create_thumbnail saving for images not requiring resize
  • Loading branch information
jezdez committed Sep 13, 2013
2 parents e98d93a + 6c9b44e commit 92212bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion avatar/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from django.conf import settings
from django.db import models
from django.core.files import File
from django.core.files.base import ContentFile
from django.core.files.storage import get_storage_class
from django.utils.translation import ugettext as _
Expand Down Expand Up @@ -121,7 +122,7 @@ def create_thumbnail(self, size, quality=None):
image.save(thumb, AVATAR_THUMB_FORMAT, quality=quality)
thumb_file = ContentFile(thumb.getvalue())
else:
thumb_file = ContentFile(orig)
thumb_file = File(orig)
thumb = self.avatar.storage.save(self.avatar_name(size), thumb_file)
except IOError:
return # What should we do here? Render a "sorry, didn't work" img?
Expand Down

0 comments on commit 92212bf

Please sign in to comment.