Hi,

I am using Appfuse for my application. Its a great starting point and thanks
to all the developers. In my application, I want to add "profile picture"
functionality. I looked over internet and I am kind of confused what is the
best way to do it. It would be great if someone can help me here.

Here is what I found. There are two ways to store and serve images:

1. Store images in a database. Lot of links suggest that it is not the best
way especially if the images are large (and many), which I think is a valid
point. JFYI, I am using MySQL.

2. Store images in filesystem. Looks like this solution is not a clean
solution and it might be difficult to migrate the application (in future if
needed). And it is slower than the database operation. But it is still good.

My first question is: which is better and scalable? Is there a good
article/discussion about it?

My second question is related to serving the image to jsp: even after
looking at so many forums, its still not clear to me how to store and serve
images in the appfuse settings (in any of the two options). Imagine an
action servlet (lets call it UserAction) which serves some attributes (like
user name, age, gender etc). To serve the image to jsp, can I just add new
private variable like

private byte[] image;

and build the image when the servlet is called OR do I need another servlet?


Finally, for now I am assuming that code to store images would be similar to
one in FileUploadAction.java (if it is stored in filesystem). Am I right?

Thanks a lot,
Amit

Reply via email to