I have a mistery with my PHP code going wrong in some cases and I don't understand why. My current code is displaying all photos related to the client by a range.
Example: pick all inside the folder from pictures 300 to 310 and display them.
Example of photos names inside my folder: C20_0385, C20_0386, C20_0389, C20_0400...
Current PHP code: with photos from 385 to 420.
$start = 385:
$end = 420;
$dirname = "smallphotos/$jour_creation - $date_creation/$session/$dossier";
$filenames = glob("$dirname/*{" . implode(",", range($start, $end)) . "}*", GLOB_BRACE);
foreach ($filenames as $filename)
{
echo "<img class=\"img-responsive\" src=\"$filename\" alt=\"$filename\">";
}
That works perfectly and now if I do $start = 385; $end = 450;
It write errors:
Warning: glob(): Pattern exceeds the maximum allowed length of 260 characters
Warning: Invalid argument supplied for foreach()
If I do from $start = 385; $end = 435;
it shows the whole folder currently up to C20_503.JPG
It looks like for small range more or less 40 photos it does the job but for more something is going wrong.