Title: Cannot load images with php script using exec-php&#8230;
Last modified: August 19, 2016

---

# Cannot load images with php script using exec-php…

 *  [jderosa3](https://wordpress.org/support/users/jderosa3/)
 * (@jderosa3)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/cannot-load-images-with-php-script-using-exec-php/)
 * I have some code that I know works – as I have tested it with MAMP to make sure…
 *     ```
       <?php
       $dir = "./flash/portfolio/branding/images/";
       $jpgs = glob($dir . "*.jpg");
   
       foreach ($jpgs as $jpg) {
           echo "<img src='{$jpg}' /><br />";
       }
       ?>
       ```
   
 * but when I use this in one of my pages in wordpress all it shows is 5 broken 
   image links… it’s odd it has the correct number of files… but it is as if wordpress(
   or exec-php) will not render the jpgs..
 * any ideas here?

Viewing 1 replies (of 1 total)

 *  Thread Starter [jderosa3](https://wordpress.org/support/users/jderosa3/)
 * (@jderosa3)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/cannot-load-images-with-php-script-using-exec-php/#post-1064496)
 * I figured it out for anyone that need to know how to do this if they are accessing
   a directory in the root of their server:
 *     ```
       <?php
       $dir = "./flash/portfolio/branding/images/";
       $jpgs = glob($dir . "*.jpg");
   
       foreach ($jpgs as $jpg) {
           $jpg = substr($jpg, 1);
           echo "<img src='http://www.mydomain.com{$jpg}' /><br />";
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Cannot load images with php script using exec-php…’ is closed to new 
replies.

## Tags

 * [images](https://wordpress.org/support/topic-tag/images/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 1 reply
 * 1 participant
 * Last reply from: [jderosa3](https://wordpress.org/support/users/jderosa3/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/cannot-load-images-with-php-script-using-exec-php/#post-1064496)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
