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??? 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] Link to comment https://forums.phpfreaks.com/topic/10230-loading-images/#findComment-38141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.