Hey everyone,

Quick summary of what I'm trying to do:
There are images stored in an ImageField. I need to be able to edit
this image (I'm using ImageDraw from the PIL), put it into a separate
ImageField in the same entry, so that it's also accessible from the
front-end.

I, however, am having problems getting the file saved into the entry
and uploaded to the right location. To the best of my knowledge, the
best location to save the new image would be in my MEDIA_ROOT, where
the other, unaltered images also reside. That path is somewhat tricky
to get, though. I can save the image to the filesystem, but that
doesn't make any sense when saved into the ImageField since it gets
appended to the MEDIA_ROOT

Here's what my code looks like right now

#copy is a Image
#floor is a Model
    path = '/tmp/' + str(floor.name).replace(' ','_') + 'd.jpg'
    copy.save(path,'JPEG')

    f = open(path)
    file = File(f)
    floor.drawnMap = file #drawnMap is an ImageField
    floor.save()

So the file is successfully saved into the tmp folder, and I was
hoping that the save would upload the file instead of just taking it
as is. Is there a better way to do this?

Thanks!

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

Reply via email to