Not sure if this is your problem but there are some issues with some
PIL installations and JPG files that require some potential
configuration/install-time magic, so make sure you test on PNG's or
GIF's first and make sure its working with those.  If it ends up being
JPG-specific issue, and google doesn't turn up the work-through for
it, post here, and I can dig up the blog posts I used to resolve my
JPG issues with PIL and Django's ImageField.

Ben

On Jul 18, 7:23 am, Malcolm Box <malcolm....@gmail.com> wrote:
> On 18 July 2011 02:04, galgal <weglarek.rob...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > def upload_path_handler(instance, filename):
>
> > return filename
>
> > class SpectacleGallery(models.Model):
>
> >  image = models.ImageField(upload_to=upload_path_handler)
>
> > def save(self, *args, **kwargs):
>
> >  Image.open(self.image)
>
> >  super(SpectacleGallery, self).save(*args, **kwargs)
>
> >  When I try to open it I get:
>
> > IOError at /admin/index/spectacle/1/
> > cannot identify image file
>
> You should be able to pass SpectacleGallery.image to PIL open - I've done
> similar things in the path.
>
> What happens when you step through the code - what's the value of
> self.image? Is it really a valid image file? Is it where it thinks it is?
>
> Malcolm

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to