Images in different sizes stored in the file system. How to handle the filenames in the Database

by Rostislav   Last Updated May 15, 2018 16:05 PM

I have a dating site where each user has many photos. When the user uploads the photo, I create three different photo sizes - small, medium, big with different pixels. The question is how to persist the names of the files in the database. Should I have all three records with the file and path names, or I can have only the primary one and all others to be accessed via the hardcoded link with a prefix. Melanie.jpg is stored in the database with one record, and all other sizes can be accessed via:

big_dsfdsfs_Melanie.jpg
small_dsfdsfs_Melanie.jpg
medium_dsfdsfs_Melanie.jpg

In the other case, I will have for every one image, three records in the database.



Related Questions


Best approach for storing large 3d files?

Updated April 21, 2016 08:02 AM

Playlist Storage for Music App

Updated June 20, 2018 12:05 PM