Errors on ThumbnailerImageField uploads #160

Closed
staticdev opened this Issue Jun 28, 2012 · 2 comments

Projects

None yet

2 participants

@staticdev

I am using Django 1.5alpha0, installed with pip and put 'easy_thumbnails' on the settings file. And also put: THUMBNAIL_DEBUG = True

I just created a model with the field:
thumbnail = ThumbnailerImageField(verbose_name=u"Photo", upload_to='uploads/profile_photos', max_length=100, default='images/default_avatar.png', resize_source=dict(size=(128, 128), crop='smart'))

Nothing references the field specifically in my forms.py. I created the folder uploads/profile_photos in the /media folder. But when I post a form using JPGs or PNGs, the value stored in the database is always images/default_avatar.png and no file inside the folders I created. And I see no messages or errors provided by the THUMBNAIL_DEBUG.

I'm using an isolated virutalenv installed with:
-e git://github.com/django/django.git@b9ecbed#egg=Django-dev
PIL==1.1.7
distribute==0.6.27
django-debug-toolbar==0.9.4
django-form-utils==0.2.0
django-pagination==1.0.7
django-reversion==1.6.1
django-xhtml2pdf==0.0.3
easy-thumbnails==1.0.3
psycopg2==2.4.5
wsgiref==0.1.2
yolk==0.4.3

UPDATED: I discovered I have to put enctype="multipart/form-data" in the 'form' tag, like in Django's FileField. But in the Installation ou Usage documentation nothing mentions that. I suggest to put it in the front page of the app. Despite that, I continue having troubles. See my comment below.

@staticdev

After I change my template to put the enctype="multipart/form-data" in the 'form' tag, still when submitting the forms I get the validation error message:
Upload a valid image. The file you uploaded was either not an image or a corrupted image. (when I use both PNG and JPG images).

And when I try GIF images, I get:

IOError at /people/add/
encoder jpeg not available

Request Method: POST
Request URL: http://127.0.0.1:8000/people/add/
Django Version: 1.5.dev20120629131041
Exception Type: IOError
Exception Value:

encoder jpeg not available
Exception Location: /home/static/virtualenvs/prp/local/lib/python2.7/site-packages/PIL/PIL/Image.py in _getencoder, line 401
Python Executable: /home/static/virtualenvs/prp/bin/python
Python Version: 2.7.2

@SmileyChris
Owner

PIL configuration error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment