perezf Posted May 23, 2006 Share Posted May 23, 2006 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/10264-loading-images-not-working/ Share on other sites More sharing options...
michaellunsford Posted May 23, 2006 Share Posted May 23, 2006 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 Link to comment https://forums.phpfreaks.com/topic/10264-loading-images-not-working/#findComment-38254 Share on other sites More sharing options...
perezf Posted May 23, 2006 Author Share Posted May 23, 2006 [!--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 folderbut if i dont specify it then it works Quote Link to comment https://forums.phpfreaks.com/topic/10264-loading-images-not-working/#findComment-38256 Share on other sites More sharing options...
michaellunsford Posted May 23, 2006 Share Posted May 23, 2006 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". Quote Link to comment https://forums.phpfreaks.com/topic/10264-loading-images-not-working/#findComment-38260 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.