It depends on if you need SEO. If you don't need it, randomizing the file name is just fine.
Do you randomize uploaded images names or tie them to meaningful IDs?
I'm at the point in a project where I will be uploading images that are associated with a specific controller. I don't foresee that they will ever be used outside this controller's context.
My general process is that I will upload the image and then store the image path/name into the associated table cell. The images will fit into a categorical system where each one will be (Front|Side|Back) + (Category) + (Level).
In naming the files, I am considering two options:
-
On one hand I like the idea of meaningfully naming the images where an example would look like f-category_id-level_id.extension (i.e. f-1-2.jpg).
-
On the other I think since I'm storing the name of the file in the database, just randomizing the filename works well too.
In the former, I like that it presents a clean and meaningful folder of files but I worry a little about maintenance. For example, if a category ID or Level ID gets changed, I need to be mindful of keeping file names consistent. In the latter, I have a messy image folder but it's completely independent of any changes to the categories or levels.
I am already leaning more towards one of the approaches but I was hoping to get some feedback before I commit to it. Any thoughts please?
Please or to participate in this conversation.