Hi Django'ers,

I get a strange bug, which seems to be a problem/conflict between PIL
(Python Imaging Library) and the ImageField model field. I have a
standard ImageField, but when a user tries to upload an ico file
(created either at http://www.html-kit.com/favicon/ or http://www.favicon.cc/),
django crashes with this traceback (see below).

At a Python prompt I can use PIL to open an ico file just fine, but
django further asks PIL to decode the file, and somewhere in that
process it fails and the error isn't caught. I can't find any problems
on the web regarding PIL and its handling of ico files. Has anyone
ever come across this, and/or does anyone have any suggestions? I
figure I can just use a FileField, since the data then wouldn't be
validated by PIL, but other ideas/workarounds are welcome.

Thanks :) Michael

Traceback (most recent call last):

 File "C:\Program Files\Python\lib\site-packages\django\core\handlers
\base.py", line 86, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "C:\Program Files\Python\lib\site-packages\django\contrib\admin
\sites.py", line 157, in root
   return self.model_page(request, *url.split('/', 2))

 File "C:\Program Files\Python\lib\site-packages\django\views
\decorators\cache.py", line 44, in _wrapped_view_func
   response = view_func(request, *args, **kwargs)

 File "C:\Program Files\Python\lib\site-packages\django\contrib\admin
\sites.py", line 176, in model_page
   return admin_obj(request, rest_of_url)

 File "C:\Program Files\Python\lib\site-packages\django\contrib\admin
\options.py", line 197, in __call__
   return self.change_view(request, unquote(url))

 File "C:\Program Files\Python\lib\site-packages\django\db
\transaction.py", line 238, in _commit_on_success
   res = func(*args, **kw)

 File "C:\Program Files\Python\lib\site-packages\django\contrib\admin
\options.py", line 570, in change_view
   new_object = self.save_form(request, form, change=True)

 File "C:\Program Files\Python\lib\site-packages\django\contrib\admin
\options.py", line 370, in save_form
   return form.save(commit=False)

 File "C:\Program Files\Python\lib\site-packages\django\forms
\models.py", line 319, in save
   return save_instance(self, self.instance, self._meta.fields,
fail_message, commit)

 File "C:\Program Files\Python\lib\site-packages\django\forms
\models.py", line 61, in save_instance
   f.save_form_data(instance, cleaned_data[f.name])

 File "C:\Program Files\Python\lib\site-packages\django\db\models
\fields\files.py", line 192, in save_form_data
   getattr(instance, self.name).save(data.name, data, save=False)

 File "C:\Program Files\Python\lib\site-packages\django\db\models
\fields\files.py", line 209, in save
   self._dimensions_cache = get_image_dimensions(content)

 File "C:\Program Files\Python\lib\site-packages\django\core\files
\images.py", line 39, in get_image_dimensions
   p.feed(data)

 File "C:\Program Files\Python\lib\site-packages\PIL\ImageFile.py",
line 413, in feed
   self.decoder.setimage(im.im, e)

ValueError: tile cannot extend outside image
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to