@yasin masmoudi You will need a custom sort function, this is a rough implementation but i'm pretty sure it could be made cleaner and more optimized using collections:
private static function my_compare($a, $b){
if(strlen($a->getFileName()) > strlen($b->getFileName()))
return -1;
if(strlen($b->getFileName()) > strlen($a->getFileName()))
return 1;
return (a->getFileName() < b->getFileName()) ? -1 : 1;
}
and then on your controller you would sort the array before passing it to your view like so:
$files = File::files(public_path('img'))
usort($files, array("controller_class", "my_compare"));
Anyway that's a very rough idea. hope it helps.