Upload picture -> AJAX Thumbnail -> Save in DB

11 views
Skip to first unread message

Oni

unread,
Mar 7, 2009, 9:22:40 AM3/7/09
to Django users
Hi all. Im wondering about an admin modification. I've managed to
create a few ajax forms for the admin interface of django before now
but I'm what I'm really after is getting the user to upload an image.
This image is saved "somewhere" and the next page of the form comes
up. This page has my ajax widget that allows the user to interactively
crop the image. This image then gets saved to the database and model
and NOT the original one. Anyone have any thoughts on such a two stage
process?

Cheers
Ben

Alex Gaynor

unread,
Mar 7, 2009, 9:25:04 AM3/7/09
to django...@googlegroups.com
As best I recall you can't do a multipart form submission over Ajax, so you need something like an iFrame I think.

Alex

--
"I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire
"The people's good is the highest law."--Cicero

Oni

unread,
Mar 7, 2009, 9:31:06 AM3/7/09
to Django users
Thats not quite what I mean. The AJAX bit is only there to get a set
of co-ordinates that will be passed to PIL to do its stuff. In fact,
forget Ajax for now. What i want is a multipart form in the admin
section BUT the image uploaded in the first form MUST be available in
the second form.

One way I can see of doing this is having a temp table:

user uploads master image
master image is saved to temp table
new image is displayed on next multipart form with the option to crop
new cropped image is created from the previous master
all temp table is cleared.

Would that be a good way of doing it or can you think of another?
Cheers for the speedy feedback.

Ben

On Mar 7, 2:25 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages