Page 1 of 1
optimize image upload and resize/crop process
Posted: Sun Feb 10, 2008 5:41 am
by mechamecha
Hello,
I'm looking for ways to optimize my current image upload and resize/crop process. I have a website w/ a registration process that includes uploading a photo.
My current implementation is as follows:
1. User uploads a photo to my web server
2. Photo is rescaled and cropped on my web server using imagick extension
3. Photo is then uploaded to s3 for storage.
The problem is that the user has to wait for all 3 steps to complete before moving on to the second phase of the registration process.
Is it possible to push any of these steps into the background so that while the photo is either getting rescaled or uploaded to s3, the user can proceed w/ registration?
Thanks!
Re: optimize image upload and resize/crop process
Posted: Sun Feb 10, 2008 7:14 am
by Inkyskin
I had a similar issue - I used ajax to upload/resize while the rest of the form was filled in. Once the upload was complete, I enable the complete registration button. It also allows you do add a loading gif etc to show the upload is in progress, and when complete, it shows a thumbnail of the image within the form. (It's a nice effect if they are still filling i the form after the upload completes).
Re: optimize image upload and resize/crop process
Posted: Sun Feb 10, 2008 1:37 pm
by mechamecha
I've written my uploader in flash so that I've got a nice progress bar. And that does help a lot. However, I can't measure the progress of how long it would take to resize/crop the photo and push to s3. During that stage, I have an animation that loops and says "processing photo...please wait".
The real problem is I'm trying to get as many sign ups as possible, and what I'm finding out is ppl don't have the patience to wait for an upload if it takes too long. That's why I'm trying to make it as quick as possible.
Re: optimize image upload and resize/crop process
Posted: Mon Feb 11, 2008 2:32 am
by dbevfat
You can put the uploaded image in a queue (you can use a database for this) which you process with a scheduler (say, cron). This way, the user can go on with registration immediately after uploading and his photo will be resized and uploaded before he completes the registration, if you set the scheduler to run often enough. There are a few problems with this, though:
- upload validation (what if the image file is in a wrong format, too large, ... , you can't notify the user immediately),
- queue size (you store the full-size images in the queue); only a problem if you expect a lot of simultaneous registrations.
But I don't think these are too serious.
regards
Re: optimize image upload and resize/crop process
Posted: Tue Feb 12, 2008 2:41 am
by mechamecha
dbevfat,
Great idea! I don't think storing the full size images on my webserver would be too much of a problem since its only temporarily. Maybe I can do something where I present the user w/ the photo that's stored on my server until the cron job runs and completes the rescale/crop job. THen I swap photos and delete the original src.
Re: optimize image upload and resize/crop process
Posted: Tue Feb 12, 2008 5:42 pm
by dbevfat
That would work, but displaying the original image back to the user can be problematic if the images are large. And they'll probably be large, if I know anything about users.
