gtaylor/django-athumb

Failures when upload some formats

Closed this issue · 4 comments

Hi there. I have a bug when trying to upload a jpg file on Amazon using athumb.

Here is the model used.

PUBLIC_MEDIA_BUCKET = S3BotoStorage_AllPublic(
bucket=settings.AWS_STORAGE_BUCKET_NAME,
)

class Company(ContactInformation):
logo = ImageWithThumbsField(upload_to='companies',
thumbs=settings.THUMBS, blank=True, null=True,
storage=PUBLIC_MEDIA_BUCKET)
...

This model being registered for the django admin, I tried accessing a Company object, assigning a jpg file for the logo, then tried to save the model without success. Error raised is "Upload a valid image. The file you uploaded was either not an image or a corrupted image."
File uploaded was clearly an image and not corrupted: converting the jpg file into png format and trying again was successful.

Any idea what's going on here ?

Make sure your PIL is compiled with libjpeg support. If you've installed something other than your distro's python-imaging package, you probably don't have that by default.

Here is the PIL summary on my server (installed from pypi):

--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.6.7 (r267:88850, Jun  4 2011, 04:33:59)
              [GCC 4.4.4 20100726 (Red Hat 4.4.4-13)]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------

Bug still persists, I can't upload jpeg files. Debugging...

Can you post the JPG file somewhere?

Issue fixed. It worked from my local installation. I probably didn't reinstall PIL correctly. Reinstalling it again, as well as libjpeg-devel, freetype-devel, zlib-devel, succeeded.

Thanks for the support !