Firstly, I noticed that there are many questions in this that are marked as duplicates.
In the end, I came to this one .
And the accepted answer to this question, although it partially solves my question, does not answer all this.
My question is: user uploads image. I save the path in the database and the image file in the file system. However, I am making 3 copies of this image (large, medium and small). So, I have 4 images - original, large, medium, small.
Should I store all 4 paths in the database, for example
ID | original | large | medium | small |
----+--------------------+-----------------+-----------------+----------------+
1 | /path/to/original | /path/to/large/ | /path/to/medium | /path/to/small |
or just keep the original path and give another 3 naming convention, for example
car.jpg, car.jpg, large-car.jpg, medium-car.jpg, small-car.jpg:?
I feel that this method will be less difficult in the database, and that if I later want to add another size (i.e. extra small), I will not need to modify the database.
source
share