Problems to scan many images folders

jmorge

New Member
I have more than 10 sections/articles in a single pages and each section display 3 thumbs.3 thumbs > linking > to 1 Images_Main Images_Main = thumb1, thumb2, thumb3Structure:\[code\]Images |_______ 1stSection |__________ Images_Main |__________ img1 |__________ img2 |__________ img3 |___________ Thumb |__________ img1 |__________ img2 |__________ img3\[/code\]So, I have wrote this little code, which is working fine for the first section but is not working. It does not show right thumbs &/or Images_Main for the rest of sections. It keeps showing images from first folder, does not matter if I change: \[code\]$smallSecond_dir = 'images/small225x341/ ** 2nd / 3rd / 4thTheme/ **';\[/code\] Gets Images_Main: \[code\] <h5> <?php $smallSecond_dir = 'images/small225x341/2ndTheme/'; $scan = scandir($smallSecond_dir); echo '<img src="' . $small225x341_dir . $scan[2] . '" alt="image" />'; ?> </h5>\[/code\]Gets Thumbs:\[code\]<ul class="thumbs"> <?php $thumbs75x75_dir = 'images/thumbs75x75/2ndTheme/'; $scan = scandir($thumbs75x75_dir); for ($i = 0; $i<count($scan); $i++) { if ($scan[$i] != '.' && $scan[$i] != '..') { if (strpos($scan[$i], '.jpg') !== false) { echo ' <li> <a href="' . $smallSecond_dir . $scan[$i] . '"> <img src="' . $dir . $scan[$i] . '" alt="' . $scan[$i] . '" /> </a> </li>'; } } }; ?> </ul>\[/code\]How can I scan each sections folder and show right thumb and right Images_Main?Thanks
 
Back
Top