tags:

views:

205

answers:

2

Hello!

I'm trying to upload an image using normal form for normal admin for normal model with normal image field.

thumb = fields.ThumbnailField(upload_to=make_upload_path, sizes=settings.VIDEO_THUMB_SIZE, blank=True, null=True)

But I'm getting an error:

Upload a valid image. The file you uploaded was either not an image or a corrupted image.

But my images are valid! I've tried at least ten jpegs and getting the error. What can I do?

+3  A: 

You probably have PIL (Python Imaging Library) installed without JPEG support. If you don't have the libjpeg header files it'll happily compile and install, just with no JPEG support. You need to uninstall PIL, make sure you install libjpeg and the libjpeg development header files, and then reinstall PIL. How you do this depends entirely on your platform.

Carl Meyer
hmm so what I gonna do?
valya
@valya: exactly what he said. If you're on ubuntu it should be pretty darn easy... something like `sudo apt-get install libjpeg` and `sudo apt-get install python-imaging` (probably don't need the former actually -- should be bundled). Of course, Django could be lying and giving you a BS error message like it's done to me many a time.
Mark
thanks I gonna try
valya
A: 

What does I have to do if I running this on FreeBSD? There are no apt-get.

AntonioK
Török Gábor