Jump to content

prisonbreaker82

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

prisonbreaker82's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Error again.. MUST be something with my local server settings... It uses \ and / ... why? Warning: opendir(C:/wamp/www/\application/gallery) [function.opendir]: failed to open dir: File exists in C:\wamp\www\hello.php on line 8 Warning: readdir(): supplied argument is not a valid Directory resource in C:\wamp\www\hello.php on line 9
  2. Thank you! Now it did not get an error, but the pictures does not show If I look in the source code, I got a strange \gallery, how can I remove \ before gallery? <html><head><title>Image Gallery</title></head><body><hr /><img src='C:/wamp/www/\gallery/rianobath.jpg' /><br><hr /><img src='C:/wamp/www/\gallery/supermercado1.jpg' /><br><hr /><img src='C:/wamp/www/\gallery/tabela.jpg' /><br><hr /><img src='C:/wamp/www/\gallery/tabela1.jpg' /><br></body></html>
  3. Thank you for your replies! The code is located in a file called hello.php in the root directory www on my PC.. so I wrote like this $dir = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'gallery' But still same error..
  4. Hi All! I am a newbie of PHP. I tried to solve why I get these two error on my code below. Please help me! Thank you very much! Warning: sort() expects parameter 1 to be array, null given in C:\wamp\www\hello.php on line 13 Warning: Invalid argument supplied for foreach() in C:\wamp\www\hello.php on line 14 ------ <?php echo "<html><head><title>Image Gallery</title></head><body"; $dir = "gallery"; $dh = opendir($dir); while($filename = readdir($dh)) { $filepath = $dir.$filename; if(is_file($filepath) and ereg("\.jpg$",$filename)) { $gallery[] = $filepath; } } sort($gallery); foreach ($gallery as $image) { echo "<hr />"; echo "<img src='$image' /><br>"; } ?> </body></html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.