I want to get a thumbnail version of the uploaded image,so I have to use PIL to handle it. But I do not know why that error occured. We can know that the chafferer is either the Django or the PIL. Then I wrote a .py script to handle images of different format ,all goes well.The operations are the same as views.py. Thus,I think there may be a problem in Django.
On Apr 9, 2:41 pm, Kushal Das <kushal...@gmail.com> wrote: > On Thu, Apr 9, 2009 at 11:15 AM, higer <higerinbeij...@gmail.com> wrote: > > > When I upload a PNG file and usePILto handle it,there will be an > > error occured: > > 'NoneType' object is unsubscriptable > > > I do not know why and other formats(BMP GIF JPG JPEG) are all ok. > > The following is my code in my views.py: > > > f = request.FILES["imagefile"] > > fileExt = (f.name).split(".")[-1].lower() #get the pic's extension > > parser = ImageFile.Parser() > > for chunk in f.chunks(): > > parser.feed(chunk) > > img = parser.close() > > img.save("test"+"."+fileExt) > > I guess you can save the file uploaded directly, any special reason to usePIL? > > Kushal > --http://fedoraproject.orghttp://kushaldas.in --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 -~----------~----~----~----~------~----~------~--~---