Title: opendir folder path issue
Last modified: August 20, 2016

---

# opendir folder path issue

 *  [Shirley Studebaker](https://wordpress.org/support/users/shirley-studebaker/)
 * (@shirley-studebaker)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/opendir-folder-path-issue/)
 * I can’t seem to get WP to recognize correct image folder path. Anybody see anything
   wrong with this??
 *     ```
       <?php
   
           global $post;
           $post_slug=$post->post_name;
   
       	$img_directory = bloginfo("template_directory");
       	$img_directory .= '/images/'.$post_slug;
       	echo $img_directory;
       	// Styling for images
       	echo '<div id="myslides">';
       	if ($handle = @opendir($img_directory) or die("There is an error with your image directory!")) {
       		while (false !== ($file = readdir($handle))) {
           		if (strpos($file, ".jpg")) {
       				$path = $img_directory . '/' . $file;
       				echo '<img src="' . $path . '"/>';
           		}
       		}
       		closedir($handle);
       	}
       	echo '</div>';
       ?>
       ```
   

The topic ‘opendir folder path issue’ is closed to new replies.

## Tags

 * [folder](https://wordpress.org/support/topic-tag/folder/)
 * [path](https://wordpress.org/support/topic-tag/path/)

 * 0 replies
 * 1 participant
 * Last reply from: [Shirley Studebaker](https://wordpress.org/support/users/shirley-studebaker/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/opendir-folder-path-issue/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
