python - django-avatar: cant save thumbnail -


i'm use django-avatar app , can't make save thumbnails. original image save in media dir. using step execution showed error occurred here

image.save(thumb, settings.avatar_thumb_format, quality=quality) 

i found line in create_thumbnail:

def create_thumbnail(self, size, quality=none):     # invalidate cache of thumbnail given size first     invalidate_cache(self.user, size)     try:         orig = self.avatar.storage.open(self.avatar.name, 'rb')         image = image.open(orig)         quality = quality or settings.avatar_thumb_quality         w, h = image.size         if w != size or h != size:             if w > h:                 diff = int((w - h) / 2)                 image = image.crop((diff, 0, w - diff, h))             else:                 diff = int((h - w) / 2)                 image = image.crop((0, diff, w, h - diff))             if image.mode != "rgb":                 image = image.convert("rgb")             image = image.resize((size, size), settings.avatar_resize_method)             thumb = six.bytesio()             image.save(thumb, settings.avatar_thumb_format, quality=quality)             thumb_file = contentfile(thumb.getvalue())         else:             thumb_file = file(orig)         thumb = self.avatar.storage.save(self.avatar_name(size), thumb_file)     except ioerror:         return  # should here?  render "sorry, didn't work" img? 

maybe need library?

error was: 'encoder jpeg not available'. i've fixed this:

sudo apt-get build-dep python-imaging  pip uninstall pillow pip install pillow 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -