WordPress.org

Ready to get started?Download WordPress

Forums

Cannot load images with php script using exec-php... (2 posts)

  1. jderosa3
    Member
    Posted 5 years ago #

    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?

  2. jderosa3
    Member
    Posted 5 years ago #

    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 />";
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags