On Aug 28, 8:53 pm, julianb <[EMAIL PROTECTED]> wrote: > I tried several things, I think Marty's solution was among them. It > did not throw errors, but the file I got was 0 bytes. I will try again > and check if I made a mistake or so...
Okay, I solved the puzzle. The following works: big = StringIO.StringIO() # you have a StringIO ... image.save(big, "JPEG", quality=70) # write something to the StringIO ... # Photo is a model that has an image field photo = Photo(user=creator) # use getvalue because ContentFile just needs content big_file = ContentFile(big.getvalue()) # use save method of image field, no other function! photo.data.save("%s.jpg" % name, big_file) --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---