3534 Local image cropping issues

Last Update: May 09, 2015

#3534 Local image cropping issues

With our new server architecture we want many wa-app servers. This poses a problem with our current image uploading process. We currently upload an image locally to the app server and then we manipulate (resize, crop, thumbnail).

This issue at the moment is that we upload to our app server(1-N), then render the image back to the user using the same app servers(1-N). If an image is uploaded to server1 and the image request is routed to server2 we have a problem.

To fix this we need to either route all image uploads/requests to 1 server or come up with a solution in the code.

I think we should adjust the code to fix this problem as we don't want WA to rely on 1 server and have specific load balance routing rules for all our images.

All images can still be uploaded to the app servers for manipulation, but we should upload to S3 when we need to display the image back to the user, for example when displaying the cropper UI.

Here's how I see the steps for all our uploaded images that require cropping:

  1. Image is uploaded to wa-app server. The code decides if a resize is required and resizes if necessary (no code changes so far). The change is that now we upload this original or resized image to S3. After this image is up on S3 we should delete the local file.
  2. The image url that is returned for use in the cropping tool should now be the S3 URL.
  3. The user chooses the cropping coordinates and sends a crop request back to the wa-app server.
  4. The wa-app downloads the image from S3 first, then performs the crop and thumbnail operations. Once complete the cropped and thumbnail images are uploaded to S3 and all local files are deleted.
The main change here is that we cannot have our wa-app programmed to expect a user uploaded image to exist locally at all.
Join the Discussion
Write something…
Top