how to get images from a directory using glob - previous post not working
<p>I'm new to php and I'm trying to get a directory listing of images.<br>
I saw this post: <a href="http://stackoverflow.com/questions/1761252/how-to-get-random-image-from-directory-using-php">how to get random image from directory using php</a></p>

<p>I am trying to do nearly the same thing- choosing a random image and drawing it to the page via an  tag.</p>

<p>For some reason, the specification to the directory that I am using doesn't work, but I'm not sure why.  I've tried the following:</p>

<pre><code>$localdir = $_SERVER['DOCUMENT_ROOT'] . '/wp_content/themes/overlandconsulting_2010/images/headers/*.{jpg,gif,png}';
$images = glob($localdir, GLOB_BRACE);

$httpdir = $_SERVER['SERVER_NAME'] . '/wp_content/themes/overlandconsulting_2010/images/headers/*.{jpg,gif,png}';
$images = glob($httpdir, GLOB_BRACE);
</code></pre>

<p>Neither seems to find any images.  :s
FWIW, I can navigate to the directory explicitly and see the contents, like
<a href="http://www.overlandconsulting.dreamhosters.com/wp-content/themes/overlandconsulting_2010/images/headers/" rel="nofollow">this</a></p>

<p>It seems like the server won't let me access the images, but honestly I have no idea.</p>

<p>Thanks for any help!
jml</p>
