Re: Imagefield, PIL and save()

2009-09-03 Thread aa56280

On Sep 3, 5:31 pm, Rob Broadhead  wrote:
> If you are on a Mac there are some issues with the imagelib you will  
> need to fix.

Very interesting. I am on a Mac. So I'll investigate and update.
Thanks, Rob.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Imagefield, PIL and save()

2009-09-03 Thread Rob Broadhead
If you are on a Mac there are some issues with the imagelib you will  
need to fix. Google Mac PIL django and I think you will get three or  
four walk-throughs to fix the problem. I think you can see the error  
when you run the PIL tests, but I went through a lot of iterations  
just fixing that myself so my recollection may be a bit off.

On Sep 3, 2009, at 5:23 PM, aa56280 wrote:

>
> I have an ImageField in a model. I also have a ModelForm for this
> model. I'm overriding save() so that I can take the image that was
> uploaded and make a thumbnail out of it using PIL.
>
> I'm using the simplest of examples just to get started:
>
> ...
> def save(self):
>  from PIL import Image
>
>  im = Image.open(self.logo)  # 'logo' is the image field name
>  im.thumbnail((100,100), Image.ANTIALIAS)
>  im.save('test.png')
>
> No exception, no errors, but neither was a thumbnail created. I keep
> thinking something's going on with the Image.open() method, but I have
> no clue what. Any ideas greatly appreciated.
>
>
> >

Rob Broadhead
robert.broadh...@gmail.com




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Imagefield, PIL and save()

2009-09-03 Thread aa56280

I have an ImageField in a model. I also have a ModelForm for this
model. I'm overriding save() so that I can take the image that was
uploaded and make a thumbnail out of it using PIL.

I'm using the simplest of examples just to get started:

...
def save(self):
  from PIL import Image

  im = Image.open(self.logo)  # 'logo' is the image field name
  im.thumbnail((100,100), Image.ANTIALIAS)
  im.save('test.png')

No exception, no errors, but neither was a thumbnail created. I keep
thinking something's going on with the Image.open() method, but I have
no clue what. Any ideas greatly appreciated.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---