Dejan - I think this was what I was looking for (and probably should have been able to figure it out myself :)) Thanks! Are you sure there's no problem with binary or other encodings?
Thanks, Igor On May 26, 10:15 am, Dejan Noveski <dr.m...@gmail.com> wrote: > Why don't you try and copy request.FILES (request.FILES.copy()) and work > with the new dictionary. As I understand request dictionaries are immutable. > You can't change the reference of the image. Something like this: > > files_dict = request.FILES.copy() > img = files_dict['image'] > img.thumbnail( (200,200), Image.ANTIALIAS) > img.save(files_dict["image"], "JPG") > > At the end, change the reference to img > > files_dict["image"] = img > > and pass files_dict to the form instead of request.FILES > > On Wed, May 26, 2010 at 10:07 AM, Igor Rubinovich <igor.rubinov...@gmail.com > > > > > > > wrote: > > In my photo class, the field is not ImageField but rather a custom > > > image = PicasaImageField(upload_to=get_upload_to, blank=True, > > storage=pwcs()) > > > And storage=pwcs() is probably what you're asking about. > > > For the saving bit, here's some code with lots of detail omitted: > > > photo = Photo(owner=currentUser) > > photo_form = forms.PhotoEditForm(request.POST, request.FILES, > > instance=photo) > > photo.upload_to = "user/%s/gallery/album/%s/photo/%s" % > > (currentUser.username, album.title, request.FILES['image'].name) > > > photo = photo_form.save() > > > The path is emulated. I hardly use it in fact, but I could if I wanted > > to. Most of the time though I use photo objects in conjunction with > > gallery objects to which they have a foreign key. > > > Anyway, the idea is that with .save() the file goes to picasa and I > > prefer to never touch it again, at least for now. But I would like to > > resize it to sensible dimensions just before that. > > > On May 26, 9:47 am, Kenneth Gonsalves <law...@au-kbc.org> wrote: > > > On Wednesday 26 May 2010 13:07:50 Igor Rubinovich wrote: > > > > > This probably needs more explanation, otherwise I'll keep misleading > > > > people into answering some question other then mine. > > > > I store the file in a custom storage (picasaweb) that I've implemented > > > > myself. The file never touches my filesystem and always stays a stream > > > > or whatever file-like object it is until it's gone to the custom > > > > storage for good. > > > > just a clarification - how do you tell django where to store the file? > > > -- > > > Regards > > > Kenneth Gonsalves > > > Senior Associate > > > NRC-FOSS at AU-KBC > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@google > > groups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. > > -- > -- > Dejan Noveski > Web Developer > dr.m...@gmail.com > Twitter:http://twitter.com/dekomote| > LinkedIn:http://mk.linkedin.com/in/dejannoveski -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.