perezf Posted May 23, 2006 Share Posted May 23, 2006 I need a way to list all images in a specific folder specifiedbut i cant figure out how to do itcan someone help me out??? Quote Link to comment https://forums.phpfreaks.com/topic/10230-loading-images/ Share on other sites More sharing options...
michaellunsford Posted May 23, 2006 Share Posted May 23, 2006 Hope this is what you're looking for -- just some simple code I use to display images in the current folder.[code] $dir = realpath("."); //current folder. Can change the "." to "somefolder" 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.";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10230-loading-images/#findComment-38141 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.