blacktiger786 Posted March 19, 2014 Share Posted March 19, 2014 hi firend i want a create image search engine like i want search tag "glasses" its show me result reterive from my panel dir folders and sub folder i try many code but not work for me.. like i have 100 folders in my dir and all folder have sub folder like ico png ok and pictures in these sub folder now any one tell me which php code for reterive glasses name picutres from these folder Link to comment https://forums.phpfreaks.com/topic/287083-need-help-search-images-in-folder-and-subfolder/ Share on other sites More sharing options...
ginerjm Posted March 19, 2014 Share Posted March 19, 2014 You are looking for file names that match your search word? Look up the 'glob' function in the php manual. Link to comment https://forums.phpfreaks.com/topic/287083-need-help-search-images-in-folder-and-subfolder/#findComment-1473120 Share on other sites More sharing options...
blacktiger786 Posted March 19, 2014 Author Share Posted March 19, 2014 ok but can you tell me its search all dir and folders Link to comment https://forums.phpfreaks.com/topic/287083-need-help-search-images-in-folder-and-subfolder/#findComment-1473125 Share on other sites More sharing options...
ginerjm Posted March 19, 2014 Share Posted March 19, 2014 If you take the time to do your own research and read the manual as I suggested, you will find an example of exactly what I believe you are looking for. Link to comment https://forums.phpfreaks.com/topic/287083-need-help-search-images-in-folder-and-subfolder/#findComment-1473127 Share on other sites More sharing options...
blacktiger786 Posted March 19, 2014 Author Share Posted March 19, 2014 i use this code its fine when i search in one dir like <?php $dir = 'test'; if($handle=opendir($dir.'/')) { while($file=readdir($handle)) { if($file!='.'&&$file!='..') { echo '<img src="'.$dir.'/'.$file.'" width="250" hight="250"/><br>'; //echo '<a href="'.$dir.'/'.$file.'">'.$file.'</a><br>'; } } } ?> but when i ad sub dir its show error like $dir = 'test/png'; its show error Warning: opendir(test/png/): failed to open dir Link to comment https://forums.phpfreaks.com/topic/287083-need-help-search-images-in-folder-and-subfolder/#findComment-1473165 Share on other sites More sharing options...
ginerjm Posted March 19, 2014 Share Posted March 19, 2014 How about $dir = '/test/png'; Link to comment https://forums.phpfreaks.com/topic/287083-need-help-search-images-in-folder-and-subfolder/#findComment-1473171 Share on other sites More sharing options...
blacktiger786 Posted March 19, 2014 Author Share Posted March 19, 2014 i say this code not run for sub dir what i do Link to comment https://forums.phpfreaks.com/topic/287083-need-help-search-images-in-folder-and-subfolder/#findComment-1473178 Share on other sites More sharing options...
ginerjm Posted March 19, 2014 Share Posted March 19, 2014 DO YOU READ ANYTHING I WRITE? I gave you a corrected path to use. What happened when you tried it? And - did you look up the example I told you to check out earlier? Link to comment https://forums.phpfreaks.com/topic/287083-need-help-search-images-in-folder-and-subfolder/#findComment-1473180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.