| | |
Urgently need -php script for searching image
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2008
Posts: 19
Reputation:
Solved Threads: 1
Hi
can anybody help me?
I am working in a networked system. Just i want to search all the images in the H: drive. What i am exactly trying to say is, i want a search program exactly as 'istockphoto.com' of my own. Could you tell me this is possible for writing code in php.
Pleeeeeeeeeeeeeeeeease very urgent!
can anybody help me?
I am working in a networked system. Just i want to search all the images in the H: drive. What i am exactly trying to say is, i want a search program exactly as 'istockphoto.com' of my own. Could you tell me this is possible for writing code in php.
Pleeeeeeeeeeeeeeeeease very urgent!
•
•
Join Date: Dec 2008
Posts: 20
Reputation:
Solved Threads: 1
PHP Syntax (Toggle Plain Text)
<?php function isImage($fileName) { $ext = substr(strrchr($fileName, '.'), 1); if($ext <> "") { $ext = strtolower($ext); switch($ext) { case 'gif': return true; case 'jpeg': return true; case 'png': return true; case 'psd': return true; case 'bmp': return true; case 'tiff': return true; case 'jp2': return true; case 'iff': return true; case 'ico': return true; default: return false; } } else return false; } function ListMyFiles($dir,$MySearchFile) { if($dh = opendir($dir)) { $files = Array(); $inner_files = Array(); while($file = readdir($dh)) { if($file != "." && $file != ".." && $file[0] != '.') { if(is_dir($dir . "/" . $file)) { $inner_files = ListMyFiles($dir . "/" . $file,$MySearchFile); if(is_array($inner_files)) $files = array_merge($files, $inner_files); } else { if($MySearchFile == "") { if(isImage($file)) { array_push($files, $dir . "/" . $file); } } else if ( strstr( $file,$MySearchFile ) ) { if(isImage($file)) { array_push($files, $dir . "/" . $file); } } } } } closedir($dh); return $files; } } //NOTE : if u don't want to search by keywords plesae keep this field blank $MySearchFile = "test"; foreach(ListMyFiles('includes/',$MySearchFile) as $file_name) { echo "<br>".$file_name; } ?>
-- Manish Singh
manish.s@neuralit.com
manish.s@neuralit.com
•
•
Join Date: Dec 2008
Posts: 19
Reputation:
Solved Threads: 1
•
•
•
•
PHP Syntax (Toggle Plain Text)
<?php function isImage($fileName) { $ext = substr(strrchr($fileName, '.'), 1); if($ext <> "") { $ext = strtolower($ext); switch($ext) { case 'gif': return true; case 'jpeg': return true; case 'png': return true; case 'psd': return true; case 'bmp': return true; case 'tiff': return true; case 'jp2': return true; case 'iff': return true; case 'ico': return true; default: return false; } } else return false; } function ListMyFiles($dir,$MySearchFile) { if($dh = opendir($dir)) { $files = Array(); $inner_files = Array(); while($file = readdir($dh)) { if($file != "." && $file != ".." && $file[0] != '.') { if(is_dir($dir . "/" . $file)) { $inner_files = ListMyFiles($dir . "/" . $file,$MySearchFile); if(is_array($inner_files)) $files = array_merge($files, $inner_files); } else { if($MySearchFile == "") { if(isImage($file)) { array_push($files, $dir . "/" . $file); } } else if ( strstr( $file,$MySearchFile ) ) { if(isImage($file)) { array_push($files, $dir . "/" . $file); } } } } } closedir($dh); return $files; } } //NOTE : if u don't want to search by keywords plesae keep this field blank $MySearchFile = "test"; foreach(ListMyFiles('includes/',$MySearchFile) as $file_name) { echo "<br>".$file_name; } ?>
Hi,
Manish. Thanks for giving a remedy for my problem. But it shows some warning in opendir() that directory does not exist.
What shall i do?
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
•
•
•
•
Hi
can anybody help me?
I am working in a networked system. Just i want to search all the images in the H: drive. What i am exactly trying to say is, i want a search program exactly as 'istockphoto.com' of my own. Could you tell me this is possible for writing code in php.
Pleeeeeeeeeeeeeeeeease very urgent!
Are you publishing for other users on the internet like istockphoto (and offering for sale??) or do you just want to see your own pictures?
If it's just you and your own drive, try something like Google's free Picasa program. Otherwise look at some of the opensource php apps at sourceforge.net. Other than "searching", you are not being very specific about your needs, but there are several projects that are similar to what you describe.
•
•
Join Date: Dec 2008
Posts: 19
Reputation:
Solved Threads: 1
Hi,
Thank you very much for guiding me to get 'Google picasa'. This is what i am exactly wanted. But it displays all my pictures images in my computer only. When i want to search images in other system (Just i am working in a networked environment and i must share all images in all system), it displays some warning. could you help me about this problem?
Once again Thanks a lot!!!!!!!!!!!!!!!!!!!!.
Thank you very much for guiding me to get 'Google picasa'. This is what i am exactly wanted. But it displays all my pictures images in my computer only. When i want to search images in other system (Just i am working in a networked environment and i must share all images in all system), it displays some warning. could you help me about this problem?
Once again Thanks a lot!!!!!!!!!!!!!!!!!!!!.
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
•
•
•
•
Hi,
When i want to search images in other system (Just i am working in a networked environment and i must share all images in all system), it displays some warning. could you help me about this problem?
Hope that helps.
![]() |
Other Threads in the PHP Forum
- Previous Thread: need help in php forms..plz
- Next Thread: Preg_Match? Explode? Please Help :D!
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





