Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Saving image on server in directory structure vs in database

 
amar gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
amar gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please specify what will the contents in that directory under 'context' folder.
content will be static images ??

~ abhay
 
amar gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 670
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
amar gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Krishnegowda

yes it is like the photo uploads of users in facebook/orkut

thanks
Amardeep
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic