| Author |
Saving image on server in directory structure vs in database
|
amar gupta
Greenhorn
Joined: Jul 14, 2011
Posts: 4
|
|
i am working on an java web application where user can have number of images like in facebook or orkut, now i have two ways to implement it
1) keep images in directory structure on server
2) keep images in database for every user.
can you guys suggest me the best way to implement it either from above mentioned ways or any other way according to you............
thanks
Amar
|
 |
Abhay Agarwal
Ranch Hand
Joined: Feb 29, 2008
Posts: 716
|
|
Welcome to Javaranch !!!
i would suggest -- keep images iin a directory on server.
Reasons
a. images (facebook / orkut image) are static
b. Images are not tied to any user (means every user will see same image of facebook / orkut etc)
c. easier to change images in a directory if required
d. saving image for each user in databse using BLOB/CLOB type is not a good idea
~ abhay
|
Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
|
 |
amar gupta
Greenhorn
Joined: Jul 14, 2011
Posts: 4
|
|
Abhay Agarwal wrote:Welcome to Javaranch !!!
i would suggest -- keep images iin a directory on server.
Reasons
a. images (facebook / orkut image) are static
b. Images are not tied to any user (means every user will see same image of facebook / orkut etc)
c. easier to change images in a directory if required
d. saving image for each user in databse using BLOB/CLOB type is not a good idea
~ abhay
thanks Abhay for your prompt reply .......
let's suppose i am creating a directory under context folder, now when user will increase day by day, a lot of spaces occupies on server by this directory. will it effect on server any way? i really have no idea about it.
thanks
Amar
|
 |
Abhay Agarwal
Ranch Hand
Joined: Feb 29, 2008
Posts: 716
|
|
please specify what will the contents in that directory under 'context' folder.
content will be static images ??
~ abhay
|
 |
amar gupta
Greenhorn
Joined: Jul 14, 2011
Posts: 4
|
|
|
yes, content will be static image but i am talking about a scenario when application has thousand of user and each user save at least 50 static image for example there is a image folder on server that have thousand of user folder like user1 , user2........... and in each folder there is around 50 static image. i think in such case the size of image folder will become in GB so do you think it will matter in any way?? or create some problem ?
|
 |
Prasad Krishnegowda
Ranch Hand
Joined: Apr 25, 2010
Posts: 503
|
|
Hi Amar,
When you mean images, is it the images that your web site uses?, or is it like the photo uploads of users in facebook/orkut?
|
Regards, Prasad
SCJP 5 (93%)
|
 |
amar gupta
Greenhorn
Joined: Jul 14, 2011
Posts: 4
|
|
Hi Krishnegowda
yes it is like the photo uploads of users in facebook/orkut
thanks
Amardeep
|
 |
 |
|
|
subject: Saving image on server in directory structure vs in database
|
|
|