Title: While Loop Through Gallery
Last modified: August 21, 2016

---

# While Loop Through Gallery

 *  Resolved [sgajewski](https://wordpress.org/support/users/sgajewski/)
 * (@sgajewski)
 * [13 years ago](https://wordpress.org/support/topic/while-loop-through-gallery/)
 * Hey Marcel,
 * I have a quick question: I am using Eazyest Gallery (“EG”) in a custom template
   to manage the images for specific construction projects. On my main page I would
   like to create a while loop that will cycle through all the images in a specific
   folder created by EG. Is there a simple way to do this?
 * I have a folder I called “main-page-featured” in EG.
 * I was going to do something similar to (projects is my EG directory):
 *     ```
       $handle = opendir(dirname(realpath(__FILE__)).'/projects/');
   
       while($file = readdir($handle)){
       if($file !== '.' && $file !== '..'){
       echo '<img src="projects/main-page-featured/'.$file.'" border="0" />';
       }
       }
       ```
   
 * The problem this is that it cycles through all the thumbnails as well.
 * Any ideas?
 * [http://wordpress.org/extend/plugins/eazyest-gallery/](http://wordpress.org/extend/plugins/eazyest-gallery/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Marcel Brinkkemper](https://wordpress.org/support/users/macbrink/)
 * (@macbrink)
 * [13 years ago](https://wordpress.org/support/topic/while-loop-through-gallery/#post-3681600)
 * thumbnails and other resized images are stored in subdirectory `_cache`, Just
   check the directory name and skip this one.
 *  Thread Starter [sgajewski](https://wordpress.org/support/users/sgajewski/)
 * (@sgajewski)
 * [13 years ago](https://wordpress.org/support/topic/while-loop-through-gallery/#post-3681667)
 * Thanks, buddy. I appreciate the help.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘While Loop Through Gallery’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/eazyest-gallery_969cb1.svg)
 * [Eazyest Gallery](https://wordpress.org/plugins/eazyest-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/eazyest-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/eazyest-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/eazyest-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/eazyest-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/eazyest-gallery/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [sgajewski](https://wordpress.org/support/users/sgajewski/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/while-loop-through-gallery/#post-3681667)
 * Status: resolved