Code4fun wrote a tutorial on how to store images in multiple folders and serve them from controller.

image laravel

While working ony my first Laravel application http://imageshare.code4fun.io which was inspired from http://imgur.com I had to figure out how to best store the images in the public folder. Looking at imgur and the links it servers which look like this

http://i.imgur.com/MklswxJ.jpg

http://i.imgur.com/3ZwfxBa.jpg

http://i.imgur.com/LSC4baf.jpg

I asumed that imgur was storing all those millions of images in a same folder so I proceded to do the same storing all uploaded images directly inside public folder. Later I did some research how many files you can have in a folder and if it would have any performance penalties the more files you had. I found out that you should definitly not store lots of images in the same folder.

This post is submitted by code4fun.io