Unlike some of the other methods in PIL "thumbnail" modifies the file
in place and returns None. This will probably do what you expect:

import Image
ARTICLE_LARGE_SIZE = 230,300
tmp_file = Image.open(form.cleaned_data['image'])
tmp_file.thumbnail(ARTICLE_SMALL_SIZE)
tmp_file.save(location + '/small.jpg', 'JPEG')


On 10 January 2011 15:09, galago <prog...@gmail.com> wrote:
> I try to create thumbnail via PIL
> import Image
> ARTICLE_LARGE_SIZE = 230,300
> tmp_file = Image.open(form.cleaned_data['image'])
> tmp_file = tmp_file.thumbnail(ARTICLE_SMALL_SIZE)
> tmp_file.save(location + '/small.jpg', 'JPEG')
>
> I get: 'NoneType' object has no attribute 'save'
> WTF?
> When i replace tmp_file.thumbnail to tmp_file.resize all is fine but i loose
> proportions:/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
steve
http://stevemcconville.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to