0

This used to be located at http://elijahhoffman.com/index.php?q=editorial&z=one and is now located at http://elijahhoffman.com/editorial/one

the folder path used to read just 'galleries/editorial_i'; but it wasn't working, i assumed because of the new path location... so i appended the full url to the path and it still doesn't work... thoughts?

<?php

    $folder = 'http://elijahhoffman.com/galleries/editorial_i/';
    $handle = opendir($folder);
    while (false !== ($file = readdir($handle))) {
       if ($file != '.' && $file != '..') {
          $files[] = $file;
       }
    }
    closedir($handle);
    sort($files);
    foreach ($files as $file) {
      print <<<EOF
      <img src="{$folder}/{$file}" class="imgfullmargin" alt="{$file}"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      EOF;
    }
 ?>
rootsup
  • 315
  • 2
  • 17
  • 1
    Your value for `$folder` isn't a directory, it's a url and probably not one that supports directory listing: as far as I'm aware, only file:// and ftp:// support this, not http:// – Mark Baker Jan 02 '14 at 18:51
  • According to the [specs](http://php.net/manual/en/function.opendir.php), "4.3.0 path can also be any URL which supports directory listing, however only the file:// URL wrapper supports this in PHP 4." – showdev Jan 02 '14 at 18:52
  • http://php.net/opendir#refsect1-function.opendir-changelog, as you can see you are not able to use http://, only file:// and ftp:// – Jan Strnádek Jan 02 '14 at 18:54

1 Answers1

0

The parameter passed to opendir should be a path, not an url:

$folder = './galleries/editorial_i/';
$handle = opendir($folder);
...
ProGM
  • 6,949
  • 4
  • 33
  • 52