I kept getting a validation error in the django admin pages while trying to upload an image. The validation error said:
Upload a valid image. The file you uploaded was either not an image or
a corrupted.
I really broke my brains on this one but finally got it to work! I knew for sure that the image was not corrupted so it had to be something else. After some googling I found a couple of pages on the Python Imagina Library and how it was kinda difficult to get that installed properly on MacOS. When I first installed Django I just used the standard “python setup.py install” command for installing PIL, but that did not install it correctly.
What worked for me was the following:
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
./configure –enable-shared
make
sudo mkdir -p /usr/local/include
sudo mkdir -p /usr/local/bin
sudo mkdir -p /usr/local/lib
sudo mkdir -p /usr/local/man/man1
sudo make install
JPEG_ROOT = none
ZLIB_ROOT = noneJPEG_ROOT = “/usr/local/include”
ZLIB_ROOT = “/usr/local/include” python setup.py build_ext -i
python selftest.py
sudo python setup.py installThat should be it! Hope that helps anyone!
Thank you so much for this detailed post. After much head banging, I couldn’t figure out why uploading jpegs wasn’t working. This worked perfectly.
Good to hear it was helpful!
Thanks !
Thank you so much, was really helpful and works like a charm!
THANKS! Couldn’t be more concise. Worked first time!
Thank you!! This type of thing can take hours and hours to diagnose and repair — and your recipe “just works”…!
Thanks!