Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the best way to manage Photos on a web application?

Tags:

image

I am building a Photo centric website. I wanna learn how to store photos on disk as well as database. diff sized thumb nails.. etc. Can some one guide me with the same ?

like image 765
Harsha M V Avatar asked Jan 22 '23 19:01

Harsha M V


2 Answers

Look at imagemagick. Oh - And you shouldn't store images in a database. Use a file on disk, possibly with a name generated from an id in the database.

like image 57
troelskn Avatar answered Feb 08 '23 17:02

troelskn


I found this to work for me

The best way to Organise photos for a web app is

  1. Either Store the File names Seo friendly or use a UUID
  2. store the original photos at one place just incase u plan to change the layout and need to resize them to different sizes
  3. Make seperate folders for differnt image sizes like 200x400, 150x150 or xlarge, large, medium, small etc.
  4. store the respective images with the filename u chose from step 1 as it is. no need of renaming it.
  5. referencing is much easier. all you have do is. refernce a file and make sure its from the correct folder.

Thanks Santosh for helping me out.

like image 40
Harsha M V Avatar answered Feb 08 '23 15:02

Harsha M V