views:

40

answers:

1

Hi,

this is for user avatar and users photo albums. I have gotten upload working but i need some guidelines on: when to do the following steps: image resize and update database with image info.

The upload is handled by a simple cgi script on the front-end server instead of the main app server behind it in order to avoid to tie up the main app server with image upload.

should I:

  • resize the image and update database with image info after finishing file upload in the upload script? my concern is that that may take too long.

  • setup a persistent daemon to monitor the upload directory and handle the resize/update database part. This one is hard to control and user may not be able to see the image as the daemon has yet to process it.

How do other people handle this efficiently?

A: 

If rescaling and/or cropping the image is be performed, it's probably best to calculate the result as soon as it has uploaded so you can display the result for the uploader to approve. ImageMagick is pretty speedy: Wikimedia uses it to rescale images (as for thumbnails) during page display.

So what if an upload takes awhile? The typical network speed is decreased in that direction, so most users are used to slowness.

wallyk