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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 19, 2014 Share Posted March 19, 2014 How about $dir = '/test/png'; Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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.