Just one table, where path will be same for all sizes and then use ValueObject where you set suffix or prefix to that path dynamically. That's it.
https://laracasts.com/series/whip-monstrous-code-into-shape/episodes/6
Just a question on what is best approach, not how to actually do the functionality.
Scenario: User uploads image and details are stored in "media" table ( path to S3, file details and such)
Now this image gets resized to various sizes (main, thumb, original) so the question is where to store these records?
Option / idea 1: Add a parent_id to media table so the resized / children records are stored in same table referencing the id as parent_id.
Option / idea 2: Create a new table "media_files" or some name which hold the resized images records and references back to media_id.
Both pretty much same idea but use 1 table or 2?
Side note, the media might be a morph since it could in theory hold users avatar, gallery images, videos, and so on so the table could be a universal storage table so I might have answered my own question since Scenario 1 seems more scalable.
But still I ask the community.
Thanks :)
Please or to participate in this conversation.