Darkmatter5 Posted January 22, 2009 Share Posted January 22, 2009 How can I run the glob function on the directory of "images/logos" for all files in the "images/logos" directory that uses the following search pattern "g8*.png". Link to comment https://forums.phpfreaks.com/topic/141981-glob-command-on-specific-directory-for-specific-string/ Share on other sites More sharing options...
Darkmatter5 Posted January 22, 2009 Author Share Posted January 22, 2009 Nevermind got it like this foreach(glob("images/logos/g" .$item. "*-small.png") as $filename) { echo "<img src='$filename'>"; } Link to comment https://forums.phpfreaks.com/topic/141981-glob-command-on-specific-directory-for-specific-string/#findComment-743405 Share on other sites More sharing options...
Darkmatter5 Posted January 22, 2009 Author Share Posted January 22, 2009 How do you use the GLOB_NOCHECK flag in glob? I've been trying this, but it's not working and I'm not sure what glob is returning if no files are found. if(glob("images/logos/g" .$item. "*-small.png",GLOB_NOCHECK)=="images/logos/g" .$item. "*-small.png") { echo "<img src='images/logos/noimage.png'>"; } else { foreach(glob("images/logos/g" .$item. "*-small.png") as $filename) { $full=str_replace("small","full",$filename); echo "<a href='$full' target='_blank'><img style='display: inline;' src='$filename'></a> "; } } Link to comment https://forums.phpfreaks.com/topic/141981-glob-command-on-specific-directory-for-specific-string/#findComment-743691 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.