Look at intervention/image.
One way to tackle images is to rename them to random string (ie md5), save that md5 and full name ({md5}.jpg). That should reduce the chances of duplicate names. And save it by date like images/2014/12/08/{image}. Than you can retrieve it by parsing the created_at field. No need to have full path to the image in that case.
But it depends on what exactly you need...
It depends on your needs, but I typically rename them to something unique (storing the original name in the DB), then for different sizes I add a suffix:
1.jpg <- the original
1.100x100.jpg <- a 100x100 version
...
Just look how Blogging CMS manage their media files. As long as my programming time, the best way is using reverse date format.
Example format: /path/to/your/directories/{year}/{month}/{day}/{file-name}-{uniqid}-{width}-{height}.{ext}
Implementation: /path/to/your/directories/2014/12/10/my-photo-8ej982ejjkie-100-100.jpg
Laravel Package for image manipulation >> Intervention/Image
You also capable to store media detail informations to database.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.