0

My web application allows end users to upload image. After the image is saved to server, the image will then be viewable at my web site. To make the webapp easier to scale, I decide to store the uploaded image into different folder based on current time, like:

/images/upload/2011/11/30/image1.jpg 
/images/upload/2011/11/30/image2.jpg 
/images/upload/2011/12/29/image1.jpg
/images/upload/2011/12/29/image2.jpg

This is ok. However the image URL for end user will also include information like:

http://www.mywebapp.com/images/upload/2011/11/30/image1.jpg

which is not desireable. I am wondering whether it is possible to produce the digest for "2011/11/30/image1.jpg" as something like "8faa6933ac54cd2ae5eb575d2d966a42.jpg", save the mapping somewhere, and then serve end user with:

http://www.mywebapp.com/images/8faa6933ac54cd2ae5eb575d2d966a42.jpg

When the request for the image comes in, we look up the real image from the previously saved mapping, and serve the real image.

Is it possible to achieve the above? Or it is not relevant at all. I am using spring mvc for my application.

Thank you for your time, George

1 Answer 1

1

You could write a servlet that catches those urls and pass the image to the user as a byte-stream.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you Udo, I will have a try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.