Jump to content

Archived

This topic is now archived and is closed to further replies.

perezf

Loading Images not working

Recommended Posts

<?php $dir = realpath("photos/");
if (is_dir($dir)) {
if($dh=opendir($dir)) {
while(($file=readdir($dh))!=false) {
if(substr($file,0,1)!=".") echo "<img src=\"".$file."\"><br>".$file."<br><br>\n";
}
closedir($dh);
}
} else echo "Folder error. Try using ".realpath(".")." as a starting point."; ?>



what i am trying to do is load the images from the photos folder

Share this post


Link to post
Share on other sites
For future reference, you should really continue the discussion in your original topic.

Anyway, "not working" isn't very specific. Are you getting errors? does the folder you're using not contain images? does it contain more than images?

Share this post


Link to post
Share on other sites
[!--quoteo(post=376347:date=May 23 2006, 10:26 AM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ May 23 2006, 10:26 AM) [snapback]376347[/snapback][/div][div class=\'quotemain\'][!--quotec--]
For future reference, you should really continue the discussion in your original topic.

Anyway, "not working" isn't very specific. Are you getting errors? does the folder you're using not contain images? does it contain more than images?
[/quote]

it does not load anything when i specify the folder
but if i dont specify it then it works

Share this post


Link to post
Share on other sites
if you use that code inside your pictures folder, use the "." instead of "pictures/". If you're using it in "pictures" parent folder, then you need to tell it "pictures".

Share this post


Link to post
Share on other sites

×

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.