12👍
✅
According to Django’s source code. Those three lines are responsible for verifying images:
from PIL import Image
trial_image = Image.open(file)
trial_image.verify()
The image type could be unsupported by PIL. Check the list of supported formats here
2👍
Did you try uploading image format like gif or png? It might be that your PIL was not built with the jpeg lib properly. I had a similar issue with Django on Ubuntu. If you have ever seen the error message decoder jpeg not available
, check this link. Relevant line from the link:
$ cd libImaging
$ ./configure --with-jpeg=/somelib/lib --with-zlib=/somelib/lib
- [Django]-Django Gunicorn: Unable to find application
- [Django]-How to save django FileField to user folder?
0👍
I looked into the Django source, in django/forms/fields.py
, in the ImageField
class. Django actually does use PIL to determine when an image is valid.
- [Django]-Problems with using Select2 and Bootstrap styling
- [Django]-Ngnix – duplicate upstream "app_server" in /etc/nginx/sites-enabled/django
- [Django]-How to unit test image upload in Django REST Framework
- [Django]-Cannot Connect to Django from outside the Local Server
Source:stackexchange.com